Class OAuthSession


  • public class OAuthSession
    extends java.lang.Object
    The OAuth (2) session that handles authentication.
    Author:
    Christopher Mindus
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Disposes of the session and cleans up.
      void disposeBlocked()
      Disposes of the session because of a blocked pop-up window.
      void disposeUserCancel()
      Disposes of the session because of a user cancel action.
      AppSessionGyro getAppSessionGyro()
      Returns the application session gyro instance.
      java.lang.String getAuthenticationCode()
      Returns the authentication code, null for error or not authenticated (yet).
      java.lang.String getCallbackURL()
      Returns this server's callback URL used to complete the authentication by means of redirecting the client in the end to it.
      IOAuthListener.Code getCompletionCode()
      Gets the authentication completion "error" code.
      java.lang.String getErrorCode()
      Gets the error code returned in the callback reply, normally converted to a Code.
      java.lang.String getErrorDescription()
      Gets the error description string in case of failure.
      java.lang.String getErrorURI()
      Returns the error URI, null if none is present.
      AbstractOAuthService getService()
      Returns the service for the session.
      java.lang.String getState()
      Gets the state string that uniquely identifies the session in the server.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OAuthSession

        public OAuthSession​(IAppSessionGyro appGyro)
        Constructs a new authentication session for the application session.
        Parameters:
        appGyro - The application session.
        Throws:
        java.lang.IllegalStateException - If authentication engine is not initialized.
        java.lang.NullPointerException - If appGyro is null.
      • OAuthSession

        public OAuthSession​(IOAuthCallbackProvider callbackProvider)
        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:
        java.lang.IllegalStateException - If called outside of the Designer or if authentication engine is not initialized.
        java.lang.NullPointerException - If callbackProvider is null.
    • Method Detail

      • getAppSessionGyro

        public AppSessionGyro getAppSessionGyro()
        Returns the application session gyro instance.
        Returns:
        The instance (always non-null in Server), null in the Designer.
      • getCallbackURL

        public java.lang.String 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

        public java.lang.String getState()
        Gets the state string that uniquely identifies the session in the server.
        Returns:
        The unique session state (UUID).
      • getCompletionCode

        public IOAuthListener.Code getCompletionCode()
        Gets the authentication completion "error" code.
        Returns:
        The code.
      • getAuthenticationCode

        public java.lang.String getAuthenticationCode()
        Returns the authentication code, null for error or not authenticated (yet).
        Returns:
        The code, null otherwise.
      • getErrorURI

        public java.lang.String 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

        public java.lang.String 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

        public java.lang.String getErrorDescription()
        Gets the error description string in case of failure.
        Returns:
        The error string, or null for no error.
      • getService

        public final AbstractOAuthService 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.