public class AuthTokenUtil extends Object
| Constructor and Description |
|---|
AuthTokenUtil() |
| Modifier and Type | Method and Description |
|---|---|
static AuthToken |
consumeToken(String encodedJson)
Consumes an auth token, validating it during the process.
|
static AuthToken |
createAuthToken(String principal,
Set<String> roles,
int expiresInMillis)
Creates an auth token.
|
static AuthToken |
fromJSON(String json)
Read the auth token from the JSON string.
|
static String |
produceToken(String principal,
Set<String> roles,
int expiresInMillis)
Produce a token suitable for transmission.
|
static void |
signAuthToken(AuthToken token)
Adds a digital signature to the auth token.
|
static String |
toJSON(AuthToken token)
Convert the auth token to a JSON string.
|
static void |
validateToken(AuthToken token)
Validates an auth token.
|
public static final String produceToken(String principal, Set<String> roles, int expiresInMillis)
principal - roles - expiresInMillis - public static final AuthToken consumeToken(String encodedJson) throws IllegalArgumentException
AuthToken is returned. If the token is invalid (expired or bad
signature) then an IllegalArgumentException is thrown. Any other
error will result in a runtime exception.encodedJson - IllegalArgumentExceptionpublic static final void validateToken(AuthToken token) throws IllegalArgumentException
token - IllegalArgumentExceptionpublic static final AuthToken createAuthToken(String principal, Set<String> roles, int expiresInMillis)
principal - roles - expiresInMillis - public static final void signAuthToken(AuthToken token)
token - public static final String toJSON(AuthToken token)
token - Copyright © 2015 JBoss, a division of Red Hat. All rights reserved.