|
|
Class: Authenticator (in Authentication)
Object
|
+--Authentication::Authenticator
|
+--Authentication::BasicAuthenticator
|
+--Authentication::DigestAuthenticator
- Package:
- stx:goodies/authentication
- Category:
- Net-Authentication
- Version:
- rev:
1.4
date: 2009/11/09 13:55:49
- user: stefan
- file: Authentication__Authenticator.st directory: goodies/authentication
- module: stx stc-classLibrary: authentication
- Author:
- Stefan Vogel (stefan@zwerg)
This is an abstract superclass.
Authenticators implement the protocol to authenticate an user.
They generate challenges and check the returned credentials.
[instance variables:]
[class variables:]
Authentication::AuthenticationData
instance creation
-
authenticatorNamed: authenticatorName
-
get the authenticator name for 'Basic', 'Digest', ...
- if the authenticatorName is unknown, raise an error.
protocol
-
authenticateForResponse: aResponseString resolveUserVia: aOneArgBlock
-
authenticate using aResponseString.
Resolve users via aOneArgBlock that gets the username as argument.
Raise an exception, it authentication fails.
Answer the authenticator containing the authentication parameters
-
generateChallengeForRealm: aRealmString
-
generate a challenge for a client
** This method raises an error - it must be redefined in concrete classes **
-
initializeFromResponse: aResponseString
-
create and initialize an authenticator using aResponseString.
Answer the authenticator containing the authentication parameters
-
newAuthenticationDataFor: user secret: aSecretString
-
answer the authentication data used by this authenticator
queries
-
authenticatorClassNamed: authenticatorName
-
get the authenticator class for a
mechanism name name like 'Basic', 'Digest', ...
or raise an error
-
knownAuthenticators
-
answer the authenticator classes, we know
-
mechanismName
-
answer the name of the mechanism as known in the protocols
** This method raises an error - it must be redefined in concrete classes **
protocol
-
authenticateWithUserResolver: aOneArgBlock
-
authenticate - resolve the username via aOneArgBlock
** This method raises an error - it must be redefined in concrete classes **
-
bodyData: aStringOrByteArary
-
pass the body data.
some authenticators need this (Digest with qop=auth-int)
-
generateStaleChallenge
-
generate a challenge for a client.
This is sent when the credentials are stale, i.e. the user has already
supplied valid username/password and will not be asked again.
Not all Authenticators support stale challenges
** This method raises an error - it must be redefined in concrete classes **
-
initializeWith: aString
-
inititialize the authentiaction parameters from aString
** This method raises an error - it must be redefined in concrete classes **
-
requestMethod: methodString
-
pass the request method (like 'GET', 'POST', ...).
some authenticators need this
queries
-
isValidUri: uriString
-
anser true, if authenticator is valid for uri in uriString
-
mechanismName
-
|authenticationData|
authenticationData := Authentication::BasicAuthenticator
newAuthenticationDataFor:nil secret:'passwort'.
authenticationData storeOn:Transcript. Transcript cr.
'exception is raised if wrong passwort'.
Authentication::BasicAuthenticator new
secret:'passwort';
authenticateWith:authenticationData
|
|authenticationData|
authenticationData := Authentication::DigestAuthenticator
newAuthenticationDataFor:'testUser:testRealm' secret:'passwort'.
authenticationData storeOn:Transcript. Transcript cr.
authenticationData inspect.
|
|