public class LoginAction extends AbstractManagerAction
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.
ChallengeAction
,
ManagerError
,
Serialized FormConstructor and Description |
---|
LoginAction()
Creates a new empty LoginAction.
|
LoginAction(String username,
String secret)
Creates a new LoginAction that performs a cleartext login.
|
LoginAction(String username,
String authType,
String key)
Creates a new LoginAction that performs a login via challenge/response.
|
LoginAction(String username,
String authType,
String key,
String events)
Creates a new LoginAction that performs a login via challenge/response.
|
Modifier and Type | Method and Description |
---|---|
String |
getAction()
Returns the name of this action, i.e.
|
String |
getAuthType()
Returns the digest alogrithm when using challenge/response.
|
String |
getEvents()
Returns the event mask.
|
String |
getKey() |
String |
getSecret()
Returns the secret.
|
String |
getUsername()
Returns the username.
|
void |
setAuthType(String authType)
Sets the digest alogrithm when using challenge/response.
|
void |
setEvents(String events)
Sets the event mask.
|
void |
setKey(String key) |
void |
setSecret(String secret)
Sets the secret to use when using cleartext login.
|
void |
setUsername(String username)
Sets the username as configured in asterik's
manager.conf . |
getActionId, setActionId, toString
public LoginAction()
public LoginAction(String username, String secret)
You should not use cleartext login if you are concerned about security,
using ChallengeAction
and login with a password hash instead.
username
- the username as configured in Asterisk's
manager.conf
secret
- the user's password as configured in Asterisk's
manager.conf
public LoginAction(String username, String authType, String key)
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 challengepublic LoginAction(String username, String authType, String key, String events)
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 challengeevents
- 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.public String getAction()
getAction
in interface ManagerAction
getAction
in class AbstractManagerAction
public String getUsername()
public void setUsername(String username)
manager.conf
.public String getSecret()
public void setSecret(String secret)
The secret contains the user's password as configured in Asterisk's
manager.conf
.
The secret and key properties are mutually exclusive.
public String getAuthType()
public void setAuthType(String authType)
The digest algorithm is used to create the key based on the challenge and the user's password.
Currently Asterisk supports only "MD5".
public String getKey()
public void setKey(String key)
key
- The key to set.public String getEvents()
public void setEvents(String events)
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–2016. All rights reserved.