smalltalk
/
osmo-st-msc
Archived
1
0
Fork 0

gsm: Introduce the concept of an authenticator for a channel

The role of the authenticator is to collect information about
the subscriber and allow the GSMProcessor to accept the service,
enable encryptionor whatever is needed.
This commit is contained in:
Holger Hans Peter Freyther 2012-10-28 10:36:06 +01:00 committed by Holger Hans Peter Freyther
parent cde5fb69e7
commit 7382efcf16
5 changed files with 45 additions and 6 deletions

View File

@ -6,6 +6,7 @@ Eval [
fileIn: 'src/BSCConfig.st';
fileIn: 'src/BSCListener.st';
fileIn: 'src/BSCSCCPHandler.st';
fileIn: 'src/GSMAuthenticator.st';
fileIn: 'src/GSMProcessor.st';
fileIn: 'src/GSMMOCall.st';
fileIn: 'src/GSMLURequest.st';

View File

@ -11,6 +11,7 @@
<filein>src/BSCConfig.st</filein>
<filein>src/BSCListener.st</filein>
<filein>src/BSCSCCPHandler.st</filein>
<filein>src/GSMAuthenticator.st</filein>
<filein>src/GSMProcessor.st</filein>
<filein>src/GSMMOCall.st</filein>
<filein>src/GSMLURequest.st</filein>
@ -25,6 +26,8 @@
<sunit>OsmoMSC.BSCListenerTest</sunit>
<sunit>OsmoMSC.MSCBSCConnectionHandlerTest</sunit>
<sunit>OsmoMSC.BSCIPAConnectionTest</sunit>
<sunit>OsmoMSC.AuthTestNull</sunit>
<filein>tests/Test.st</filein>
<filein>tests/AuthTest.st</filein>
</test>
</package>

View File

@ -22,7 +22,9 @@ Object subclass: GSMAuthenticatorBase [
<comment: 'I am the base class for authenticating a given
subscriber. My subclasses can either allow everyone, store
the IMSI and IMEI or be fully GSM compliant and ask a HLR
for an authentication tuple.'>
for an authentication tuple.
When calling the callbacks make sure to go through the
connection>>#takeLocks: selector to take the required locks.'>
connection: aCon [
<category: 'creation'>

View File

@ -312,7 +312,7 @@ hosting various transactions and dispatching to them.'>
self addTransaction: aTran.
"The authentication has happend, just start the transaction."
self state = self class stateAuth ifTrue: [
state = self class stateAuth ifTrue: [
^ aTran start: aMsg
].
@ -331,10 +331,10 @@ hosting various transactions and dispatching to them.'>
auth := self class authenticator new
connection: self;
onAccept: [:auth | self takeLocks: [ self authenticationAccepted]];
onReject: [:auth | self takeLocks: [ self authenticationRejected]];
onAccept: [:auth | self authenticationAccepted];
onReject: [:auth | self authenticationRejected];
yourself.
auth start.
auth start: aMsg.
]
addTransaction: aTran [
@ -708,6 +708,7 @@ hosting various transactions and dispatching to them.'>
<category: 'auth'>
"Must be locked"
auth := nil.
state := self class stateAuth.
pending do: [:each |
each key start: each value].
pending := nil.
@ -718,7 +719,7 @@ hosting various transactions and dispatching to them.'>
"Must be locked"
"TODO"
"Send a CM Service Request to the phone"
"Send a CM Service Reject/LU Reject to the phone"
"Close down the connection. FIXME: use a better error value"
self clearCommand: 0.

32
tests/AuthTest.st Normal file
View File

@ -0,0 +1,32 @@
"
(C) 2012 by Holger Hans Peter Freyther
All Rights Reserved
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"
TestCase subclass: AuthTestNull [
<comment: 'I smoke-test the null authenticator and that it
fires an accept callback right away.'>
testImmediateAccept [
| auth accepted |
auth := GSMNullAuthenticator new
onAccept: [:a| self assert: a = auth. accepted := true];
onReject: [:a| self shouldNotImplement];
yourself.
auth start: nil.
self assert: accepted.
]
]