public abstract class LoginResult extends Object
LoginResult
describes to the gateway the result of a login attempt, including
additional authentication parameters as are necessary for service connection authentication.
When used within a LoginModule
via a LoginResultCallback
,
this class can communicate additional authentication parameters to the gateway. Specifically,
this class can establish a session timeout parameter for this LoginResult
to establish
a lifetime for the WebSocket connection built based upon this LoginResult
; and an authentication
lifetime parameter for the LoginResult
to establish a time before which the WebSocket connection
expects to be re-authenticated lest it be closed.Modifier and Type | Class and Description |
---|---|
static class |
LoginResult.Type
Type describes the result type of a Gateway Login attempt. |
Modifier | Constructor and Description |
---|---|
protected |
LoginResult() |
Modifier and Type | Method and Description |
---|---|
abstract void |
challenge(Object... challengeData)
This result describes
LoginResult.Type.CHALLENGE . |
abstract void |
failure(LoginException e)
This result describes login
LoginResult.Type.FAILURE . |
abstract LoginResult.Type |
getType()
Obtain the type of this login result.
|
abstract void |
setAuthorizationTimeout(long deltaSeconds)
For login-protected HTTP services, the authorization timeout is the inactivity period after which the user will be asked to
login to the HTTP service again.
|
abstract void |
setSessionTimeout(long deltaSeconds)
The session timeout is the time interval (in seconds) after which any WebSocket sessions authenticated with
this login result will become invalid and closed.
|
abstract void |
success()
This result describes login
LoginResult.Type.SUCCESS . |
public abstract void success()
LoginResult.Type.SUCCESS
.public abstract void failure(LoginException e)
LoginResult.Type.FAILURE
.e
- An exception describing the cause for failure.
May be null
if no exception is available.public abstract void challenge(Object... challengeData)
LoginResult.Type.CHALLENGE
.
Further authentication with the client may proceed, using the provided challenge data.challengeData
- Login-specific data to be used to continue to communicate with the client
process to achieve authentication. Should not be null
or zero-length
if authentication is to proceed. By design, the challenge data provided here should
appear space-separated in the WWW-Authenticate: HTTP header in the response to the client, provided
the final result of the login process is to challenge to client.public abstract LoginResult.Type getType()
LoginResult.Type
this object contains.public abstract void setSessionTimeout(long deltaSeconds) throws IllegalArgumentException
LoginModule
implementor to enforce the session timeout of WebSocket sessions.
If the session timeout is not specified on this LoginResult
,
the WebSocket session created using this LoginResult
does not have any lifetime restrictions
imposed upon it (unless, independently, an authorization timeout is configured - see below).
If both a session timeout and an authorization timeout are specified, the shorter of the two
will apply first. The WebSocket connection cannot outlive a specified session timeout,
regardless of any authorization timeout being set.
Setting the session timeout property to 0 indicates that this login result is not valid.
Login will fail in this case.
Setting the session timeout property to a non-negative integer indicates that this login result
is valid for that number of seconds. The WebSocket session constructed on the basis of this
login result will close after that many seconds.
Most often, it is expected that the value for setSessionTimeout(long)
is specified for
the purpose of providing a guarantee of a session timeout of a WebSocket session.
This property is similar to the maxAge
property of cookies in
RFC 2109, in the sense that the lifetime of the cookie
is determined by that property, and setting the property to 0 indicates invalidation of the cookie.deltaSeconds
- the time (in seconds) for which WebSocket sessions built based on this LoginResult are open.IllegalArgumentException
- when an invalid (negative) session timeout is attempted.public abstract void setAuthorizationTimeout(long deltaSeconds) throws IllegalArgumentException
LoginModule
implementor to
inform the gateway that the lifetime of WebSocket sessions created with the login credentials seen
in the LoginModule
should not exceed the expiration time of the login credentials.
If the authorization timeout is not specified on this LoginResult
,
the WebSocket session created using this LoginResult
does not have any lifetime restrictions
imposed upon it (unless, independently, a session timeout is configured - see above).
If both a session timeout and an authorization timeout are specified, the shorter of the two
will apply first. The WebSocket connection cannot outlive a specified session timeout,
regardless of any authorization timeout being set.
Setting the authorization timeout property to 0 indicates that this login result is not valid.
Login will fail in this case.
Setting the authorization timeout property to a non-negative integer indicates that this login result
is valid for that number of seconds. The WebSocket session constructed on the basis of this
login result will close after that many seconds, unless the WebSocket session has arranged for
re-authentication.
Most often, it is expected that the value for setAuthorizationTimeout(long)
is derived from the
expiration time of a token presented to a LoginModule
.
This property is similar to the maxAge
property of cookies in
RFC 2109, in the sense that the lifetime of the cookie
is determined by that property, and setting the property to 0 indicates invalidation of the cookie.deltaSeconds
- the time (in seconds) after which WebSocket sessions based on this login resultIllegalArgumentException
- when an invalid (negative) authorization timeout is set.Copyright © 2015. All Rights Reserved.