public class AccountCredentialsToken extends Object implements AuthenticationToken
AuthenticationToken
to represent a generic account authentication. Account is identified by an id and a
secret (of String type).
This AuthenticationToken could for example represent the widely-used user authentication mechanism providing username and password.
This token returns a String from getPrincipal()
representing account id and a byte[] from
getCredentials()
representing provided secret.
AuthenticationToken.AuthenticationTokenResolver<R extends Message>
CredentialsContainer.CredentialsMatcher
Constructor and Description |
---|
AccountCredentialsToken()
Constructor
|
AccountCredentialsToken(String accountId,
byte[] secret)
Constructor with account id and secret as byte array.
|
AccountCredentialsToken(String accountId,
String secret)
Constructor with account id and secret.
|
Modifier and Type | Method and Description |
---|---|
static AccountCredentialsToken |
create(String accountId,
byte[] secret)
Create a new
AccountCredentialsToken with given account id and secret. |
static AccountCredentialsToken |
create(String accountId,
String secret)
Create a new
AccountCredentialsToken with given account id and secret. |
Object |
getCredentials()
Returns the credentials submitted during the authentication process that verifies the submitted
AuthenticationToken.getPrincipal() account identity. |
Object |
getPrincipal()
Get the principal to which this authentication token refers, i.e. the account identity submitted during the
authentication process.
|
void |
setAccountId(String accountId)
Set account id
|
void |
setSecret(byte[] secret)
Set provided secret
|
void |
setSecret(String secret)
Set provided secret as String
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accountCredentials, bearer, httpBasicResolver, httpBearerResolver
defaultMatcher
public AccountCredentialsToken()
public AccountCredentialsToken(String accountId, String secret)
accountId
- Account idsecret
- Secret (for example a password)public AccountCredentialsToken(String accountId, byte[] secret)
accountId
- Account idsecret
- Secret (for example a password)public void setAccountId(String accountId)
accountId
- the account id to setpublic void setSecret(byte[] secret)
secret
- the secret to setpublic void setSecret(String secret)
secret
- the secret to setpublic Object getPrincipal()
AuthenticationToken
getPrincipal
in interface AuthenticationToken
public Object getCredentials()
AuthenticationToken
AuthenticationToken.getPrincipal()
account identity.getCredentials
in interface AuthenticationToken
getCredentials
in interface CredentialsContainer
public static AccountCredentialsToken create(String accountId, String secret)
AccountCredentialsToken
with given account id and secret.accountId
- Account idsecret
- SecretAccountCredentialsToken
with given credentialspublic static AccountCredentialsToken create(String accountId, byte[] secret)
AccountCredentialsToken
with given account id and secret.accountId
- Account idsecret
- SecretAccountCredentialsToken
with given credentialsCopyright © 2018 The Holon Platform. All rights reserved.