Wombat::Realm::RealmBase - internal realm base clas
Convenience base implementation of Wombat::Realm. Subclasses should
implement getName()
, getPassword()
, and getPrincipal()
.
new()
-
Construct and return a Wombat::Realm::RealmBase instance,
initializing fields appropriately. If subclasses override the
constructor, they must be sure to call
$self->SUPER::new();
getAlgorithm()
-
Return the digest algorithm used for authenticating credentials. If no
algorithm is specified, credentials will be used as submitted.
setAlgorithm($algorithm)
-
Set the digest algorithm used for authenticating
credentials. Supported algorithms include: MD5, SHA1, HMAC, MD2, and
anything else provided by the Digest library.
Parameters:
- $algorithm
-
the digest algorithm
getContainer()
-
Return the Container associated with this Realm.
setContainer($container)
-
Set the Container associated with this Realm.
Parameters:
- $container
-
the Wombat::Container associated with this Realm
- authenticate ($username, $credentials)
-
Return the Principal associated with the specified username and
credentials, if there is one, or
undef
otherwise.
Parameters
- $username
-
username of the principal to be looked up
- $credentials
-
password or other credentials to use in authenticating this username
- hasRole($principal, $role)
-
Return true if the specified Principal has the specified security
role within the context of this Realm, or false otherwise.
Parameters:
- $principal
-
the Wombat::Realm::Genericrincipal for whom the role is to be
checked
- $role
-
the name of the security role to be checked
digest()
-
Digest a submitted password using the configured algorithm and convert
the result to a corresponding hexadecimal string. If an exception is
thrown, the plain credentials string is returned.
Parameters:
- $credentials
-
the password or other credentials to use in authentication
getName()
-
Return a short name for this Realm implementation. Must be overridden
by subclasses.
getPassword($username)
-
Return the password associated with the given Principal's user
name. Should be overridden by subclasses.
Parameters:
- $username
-
the username of the Principal
getPrincipal($username)
-
Return the Principal associated with the given user name. Should be
overridden by subclasses.
Parameters:
- $username
-
the username of the Principal
start()
-
Prepare for active use of this Realm. This method should be called
before any of the public methods of the Realm are utilized.
Throws:
- Wombat::LifecycleException
-
if the Realm has already been started
stop()
-
Gracefully terminate active use of this Realm. Once this method
has been called, no public methods of the Realm should be
utilized.
Throws:
- Wombat::LifecycleException
-
if the Realm is not started
Digest,
the Wombat::Container manpage,
the Wombat::Exception manpage,
the Wombat::Realm manpage,
the Wombat::Realm::GenericPrincipal manpage
Brian Moseley, bcm@maz.org