net.sf.asterisk.manager.action
Class LoginAction

java.lang.Object
  extended by net.sf.asterisk.manager.action.AbstractManagerAction
      extended by net.sf.asterisk.manager.action.LoginAction
All Implemented Interfaces:
java.io.Serializable, ManagerAction

public class LoginAction
extends AbstractManagerAction

The LoginAction authenticates the connection.
A successful login is the precondition for sending any other action except for the ChallengeAction.
An unsuccessful login results in an ManagerError being received from the server with a message set to "Authentication failed" and the socket being closed by Asterisk.

Version:
$Id: LoginAction.java,v 1.4 2005/08/07 00:09:42 srt Exp $
Author:
srt
See Also:
ChallengeAction, ManagerError, Serialized Form

Constructor Summary
LoginAction()
          Creates a new empty LoginAction.
LoginAction(java.lang.String username, java.lang.String secret)
          Creates a new LoginAction that performs a cleartext login.
You should not use cleartext login if you are concerned about security, using ChallengeAction and login with a password hash instead.
LoginAction(java.lang.String username, java.lang.String authType, java.lang.String key)
          Creates a new LoginAction that performs a login via challenge/response.
LoginAction(java.lang.String username, java.lang.String authType, java.lang.String key, java.lang.String events)
          Creates a new LoginAction that performs a login via challenge/response.
 
Method Summary
 java.lang.String getAction()
          Returns the name of this action, i.e.
 java.lang.String getAuthType()
          Returns the digest alogrithm when using challenge/response.
 java.lang.String getEvents()
          Returns the event mask.
 java.lang.String getKey()
           
 java.lang.String getSecret()
          Returns the secret.
 java.lang.String getUsername()
          Returns the username.
 void setAuthType(java.lang.String authType)
          Sets the digest alogrithm when using challenge/response.
The digest algorithm is used to create the key based on the challenge and the user's password.
Currently Asterisk supports only "MD5".
 void setEvents(java.lang.String events)
          Sets the event mask.
 void setKey(java.lang.String key)
           
 void setSecret(java.lang.String secret)
          Sets the secret to use when using cleartext login.
The secret contains the user's password as configured in Asterisk's manager.conf.
The secret and key properties are mutually exclusive.
 void setUsername(java.lang.String username)
          Sets the username as configured in asterik's manager.conf.
 
Methods inherited from class net.sf.asterisk.manager.action.AbstractManagerAction
getActionId, setActionId, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoginAction

public LoginAction()
Creates a new empty LoginAction.


LoginAction

public LoginAction(java.lang.String username,
                   java.lang.String secret)
Creates a new LoginAction that performs a cleartext login.
You should not use cleartext login if you are concerned about security, using ChallengeAction and login with a password hash instead.

Parameters:
username - the username as configured in Asterisk's manager.conf
secret - the user's password as configured in Asterisk's manager.conf
Since:
0.2

LoginAction

public LoginAction(java.lang.String username,
                   java.lang.String authType,
                   java.lang.String key)
Creates a new LoginAction that performs a login via challenge/response.

Parameters:
username - the username as configured in Asterisk's manager.conf
authType - the digest alogrithm, must match the digest algorithm that was used with the corresponding ChallengeAction.
key - the hash of the user's password and the challenge
Since:
0.2

LoginAction

public LoginAction(java.lang.String username,
                   java.lang.String authType,
                   java.lang.String key,
                   java.lang.String events)
Creates a new LoginAction that performs a login via challenge/response.

Parameters:
username - the username as configured in Asterisk's manager.conf
authType - the digest alogrithm, must match the digest algorithm that was used with the corresponding ChallengeAction.
key - the hash of the user's password and the challenge
events - the event mask. Set to "on" if all events should be send, "off" if not events should be sent or a combination of "system", "call" and "log" (separated by ',') to specify what kind of events should be sent.
Since:
0.2
Method Detail

getAction

public java.lang.String getAction()
Returns the name of this action, i.e. "Login".

Specified by:
getAction in interface ManagerAction
Specified by:
getAction in class AbstractManagerAction

getUsername

public java.lang.String getUsername()
Returns the username.


setUsername

public void setUsername(java.lang.String username)
Sets the username as configured in asterik's manager.conf.


getSecret

public java.lang.String getSecret()
Returns the secret.


setSecret

public void setSecret(java.lang.String secret)
Sets the secret to use when using cleartext login.
The secret contains the user's password as configured in Asterisk's manager.conf.
The secret and key properties are mutually exclusive.


getAuthType

public java.lang.String getAuthType()
Returns the digest alogrithm when using challenge/response.


setAuthType

public void setAuthType(java.lang.String authType)
Sets the digest alogrithm when using challenge/response.
The digest algorithm is used to create the key based on the challenge and the user's password.
Currently Asterisk supports only "MD5".


getKey

public java.lang.String getKey()
Returns:
Returns the key.

setKey

public void setKey(java.lang.String key)
Parameters:
key - The key to set.

getEvents

public java.lang.String getEvents()
Returns the event mask.

Returns:
the event mask.

setEvents

public void setEvents(java.lang.String events)
Sets the event mask.

Parameters:
events - the event mask. Set to "on" if all events should be send, "off" if not events should be sent or a combination of "system", "call" and "log" (separated by ',') to specify what kind of events should be sent.


Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.