Package com.iizix.server.oauth
Class OAuthSession
java.lang.Object
com.iizix.server.oauth.OAuthSession
The OAuth 1.0a or 2.0 session that handles authentication.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorDescriptionOAuthSession
(IOAuthCallbackProvider callbackProvider) Constructs a new authentication session with a callback provider.OAuthSession
(IAppSessionGyro appGyro) Constructs a new authentication session for the application session.Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes of the session and cleans up.void
Disposes of the session because of a blocked pop-up window.void
Disposes of the session because of a user cancel action.Returns the application session gyro instance.Returns the authentication code, null for error or not authenticated (yet).Returns this server's callback URL used to complete the authentication by means of redirecting the client in the end to it.Gets the authentication completion "error" code.Gets the error code returned in the callback reply, normally converted to a Code.Gets the error description string in case of failure.Returns the error URI, null if none is present.For an OAuth 1.0a session, get the oauth_token used to identify the session.final AbstractOAuthService
Returns the service for the session.getState()
Gets the state string that uniquely identifies the session in the server.boolean
isOAuth2()
Checks if this authentication session is of OAuth 2.0 type.
Constructor Details
OAuthSession
Constructs a new authentication session for the application session.- Parameters:
appGyro
- The application session.- Throws:
IllegalStateException
- If authentication engine is not initialized.NullPointerException
- If appGyro is null.
OAuthSession
Constructs a new authentication session with a callback provider. Do not call this method from the Server, only the Designer is supported.- Parameters:
callbackProvider
- The callback provider.- Throws:
IllegalStateException
- If called outside of the Designer or if authentication engine is not initialized.NullPointerException
- If callbackProvider is null.
Method Details
isOAuth2
public boolean isOAuth2()Checks if this authentication session is of OAuth 2.0 type.- Returns:
- If session is of OAuth 2.0
true
is returned, otherwise for OAuth 1.0afalse
is returned. - Throws:
IllegalStateException
- If the session authentication type is not yet defined.
getOAuth1Token
For an OAuth 1.0a session, get the oauth_token used to identify the session.- Returns:
- The oauth_token.
- Throws:
IllegalStateException
- If the session authentication type is not OAuth 1.0a.
getAppSessionGyro
Returns the application session gyro instance.- Returns:
- The instance (always non-null in Server), null in the Designer.
getCallbackURL
Returns this server's callback URL used to complete the authentication by means of redirecting the client in the end to it.- Returns:
- The URL of this server with additional authentication path.
getState
Gets the state string that uniquely identifies the session in the server.- Returns:
- The unique session state (UUID).
getCompletionCode
Gets the authentication completion "error" code.- Returns:
- The code.
getAuthenticationCode
Returns the authentication code, null for error or not authenticated (yet).- Returns:
- The code, null otherwise.
getErrorURI
Returns the error URI, null if none is present. It is optionally set by the service in question.- Returns:
- The error URI, or null if not present.
getErrorCode
Gets the error code returned in the callback reply, normally converted to a Code.- Returns:
- The OAuth error code returned, or null if not present.
getErrorDescription
Gets the error description string in case of failure.- Returns:
- The error string, or null for no error.
getService
Returns the service for the session.- Returns:
- The authentication service, or null if authentication has not yet begun.
disposeBlocked
public void disposeBlocked()Disposes of the session because of a blocked pop-up window. The listener is notified, if any.disposeUserCancel
public void disposeUserCancel()Disposes of the session because of a user cancel action.dispose
public void dispose()Disposes of the session and cleans up.