com.apamax.authentication
Event Authentication


An authentication database storing hashed and salted passwords in a MemoryStore database either in memory or on disk.
See Also:
com.apamax.authentication.Authentication#createFromStore() - Authentication objects must be created using one of the static create actions.
com.apamax.authentication.Authentication#createFromPath() - Authentication objects must be created using one of the static create actions.
com.apamax.authentication.Authentication#createInMemory() - Authentication objects must be created using one of the static create actions.
com.apamax.authentication.Authentication#initialize() - Authentication objects must be initialized after creation using the initialize action.
Routes:
com.apamax.authentication.AuthenticationInitialized - 

Action summary
 voidaddUser(string username, string password, sequence<string> groups)

Add a user to the authentication database. Replaces an existing user's password and groups. The password is stored salted and hashed using MD5 crypt() password hashing.
 stringcheckHeader(string authHeader)

Check an HTTP basic Authorization header against the database.
 stringcheckRequest(com.softwareag.connectivity.httpclient.Request req)

Check an HTTP basic Authorization header in an HTTP Request against the database.
 booleancheckUser(string username, string password)

Check a users password.
 com.apamax.authentication.Authenticationstatic createFromPath(string path)

Create an Authentication database in the given path on disk.
 com.apamax.authentication.Authenticationstatic createFromStore(com.apama.memorystore.Store s)

Create an Authentication database within an already created and prepared store in the application.
 com.apamax.authentication.Authenticationstatic createInMemory()

Create an Authentication database purely in memory. The contents will not persist between runs of the correlator.
 sequence<string>getGroups(string username)

Return the groups for a given user.
 booleanhasGroup(string username, string #group)

Checks if a user is a member of a given group.
 booleanhasUser(string username)

Returns true if the database has a user of a given name.
 voidinitFromStore(com.apama.memorystore.Store store, integer id)
 integerinitialize()

Initialize the Authentication database. The database cannot be used until this has completed and routed an AuthenticationInitialized event. It should be called like:
 on AuthenticationInitialized(auth.initialize()) { // you can use auth here } 
 voidremoveUser(string username)

Remove a user from the authentication database. Does nothing silently if the user does not exist.
 voidsetGroups(string username, sequence<string> groups)

Set the groups of a user.
 voidsetPassword(string username, string password)

Set the password of a user.
 
Action detail

addUser

void addUser(string username, string password, sequence<string> groups)
Add a user to the authentication database. Replaces an existing user's password and groups. The password is stored salted and hashed using MD5 crypt() password hashing.
Parameters:
username - The username of the new user.
password - The password of the new user.
groups - The groups this user is a member of.

checkHeader

string checkHeader(string authHeader)
Check an HTTP basic Authorization header against the database.
Parameters:
authHeader - The HTTP basic header value.
Returns:
The corresponding username if the user exists and the password matches, "" otherwise.
Throws:
IllegalArgumentException If the header is not a properly formed HTTP basic header.

checkRequest

string checkRequest(com.softwareag.connectivity.httpclient.Request req)
Check an HTTP basic Authorization header in an HTTP Request against the database.
Parameters:
req - The request object to check.
Returns:
The corresponding username if the user exists and the password matches, "" otherwise.
Throws:
IllegalArgumentException If the header is not a properly formed HTTP basic header.

checkUser

boolean checkUser(string username, string password)
Check a users password.
Parameters:
username - The username to check.
password - The password to check.
Returns:
True if the user is in the database and the password matches, false otherwise.

createFromPath

com.apamax.authentication.Authentication static createFromPath(string path)
Create an Authentication database in the given path on disk.
Parameters:
path
Returns:
A new Authentication object.
See Also:
com.apamax.authentication.Authentication#initialize() - The Authentication object must be initialized after creation.

createFromStore

com.apamax.authentication.Authentication static createFromStore(com.apama.memorystore.Store s)
Create an Authentication database within an already created and prepared store in the application.
Parameters:
s - A prepared and open Store object.
Returns:
A new Authentication object.
See Also:
com.apamax.authentication.Authentication#initialize() - The Authentication object must be initialized after creation.

createInMemory

com.apamax.authentication.Authentication static createInMemory()
Create an Authentication database purely in memory. The contents will not persist between runs of the correlator.
Returns:
A new Authentication object.
See Also:
com.apamax.authentication.Authentication#initialize() - The Authentication object must be initialized after creation.

getGroups

sequence<string> getGroups(string username)
Return the groups for a given user.
Parameters:
username - The username to check.
Returns:
The groups the user is a member of.
Throws:
IllegalArgumentException If the username is not found.

hasGroup

boolean hasGroup(string username, string #group)
Checks if a user is a member of a given group.
Parameters:
username - The username to check.
#group - The group to check.
Returns:
True if the username exists and is in the group, false otherwise.

hasUser

boolean hasUser(string username)
Returns true if the database has a user of a given name.
Parameters:
username - The name of the user to check.
Returns:
True if the database has the user, false if not.

initFromStore

void initFromStore(com.apama.memorystore.Store store, integer id)
Parameters:
store
id
Routes:
com.apamax.authentication.AuthenticationInitialized - 

initialize

integer initialize()
Initialize the Authentication database. The database cannot be used until this has completed and routed an AuthenticationInitialized event. It should be called like:
 on AuthenticationInitialized(auth.initialize()) { // you can use auth here } 
Returns:
An ID for the associated AuthenticationInitialized completion event.

removeUser

void removeUser(string username)
Remove a user from the authentication database. Does nothing silently if the user does not exist.
Parameters:
username - The username of the user to remove.

setGroups

void setGroups(string username, sequence<string> groups)
Set the groups of a user.
Parameters:
username
groups - The replacement groups.
Throws:
IllegalArgumentException if the username is not found.

setPassword

void setPassword(string username, string password)
Set the password of a user.
Parameters:
username
password - The new password.
Throws:
IllegalArgumentException if the username is not found.