Class StatelessSSOProvider

  • All Implemented Interfaces:
    SSOProvider, SSOProviderPlugin, ServiceListener

    public class StatelessSSOProvider
    extends Object
    implements SSOProviderPlugin, ServiceListener
    A provider for explicitly stateless SSO tokens. Exists as a service listener to ensure that updates to whether or not stateless sessions are enabled are cached per realm. Acts as the gateway barrier for stateless sessions to hit up against when stateless sessions are not enabled (they fail validation to be handled by this provider).
    • Method Detail

      • isApplicable

        public boolean isApplicable​(jakarta.servlet.http.HttpServletRequest request)
        Description copied from interface: SSOProviderPlugin
        Determines whether this SSOProvider is applicable to the given servlet request.
        Specified by:
        isApplicable in interface SSOProviderPlugin
        Parameters:
        request - the request to check.
        Returns:
        true if the request contains an SSOToken that can be handled by this provider.
      • isApplicable

        public boolean isApplicable​(String tokenId)
        Description copied from interface: SSOProviderPlugin
        Determines whether this SSOProvider is applicable to the given token id.
        Specified by:
        isApplicable in interface SSOProviderPlugin
        Parameters:
        tokenId - the token id.
        Returns:
        true if the given token id can be parsed by this provider.
      • createSSOToken

        public SSOToken createSSOToken​(String sid,
                                       boolean invokedByAuth,
                                       boolean possiblyResetIdleTime)
                                throws SSOException,
                                       UnsupportedOperationException
        Description copied from interface: SSOProvider
        Creates an SSOToken.
        Specified by:
        createSSOToken in interface SSOProvider
        Parameters:
        sid - String representing the SSOToken Id
        invokedByAuth - boolean flag indicating that this method has been invoked by the AuthContext.getSSOToken() API.
        possiblyResetIdleTime - If true, the idle time of the token/session may be reset to zero. If false, the idle time will never be reset.
        Returns:
        SSOToken
        Throws:
        SSOException - is thrown if the SSOToken can't be created.
        UnsupportedOperationException - is thrown when other unsupported operation is performed.
      • destroyToken

        public void destroyToken​(SSOToken token)
                          throws SSOException
        Description copied from interface: SSOProvider
        Destroys an SSOToken.
        Specified by:
        destroyToken in interface SSOProvider
        Parameters:
        token - The SSOToken object to be destroyed
        Throws:
        SSOException - is thrown if the SSOToken can't be destroyed.
      • logout

        public void logout​(SSOToken token)
                    throws SSOException
        Description copied from interface: SSOProvider
        Logs out of the session underlying this SSOToken.
        Specified by:
        logout in interface SSOProvider
        Parameters:
        token - the sso token to log out.
        Throws:
        SSOException - if an error occurs during logout.
      • isValidToken

        public boolean isValidToken​(SSOToken token)
        Description copied from interface: SSOProvider
        Checks if an SSOToken is valid or not. Your token may be refreshed.
        Specified by:
        isValidToken in interface SSOProvider
        Parameters:
        token - The SSOToken object to be validated.
        Returns:
        true or false, true if the token is valid
      • isValidToken

        public boolean isValidToken​(SSOToken token,
                                    boolean refresh)
        Description copied from interface: SSOProvider
        Checks if an SSOToken is valid or not.
        Specified by:
        isValidToken in interface SSOProvider
        Parameters:
        token - The SSOToken object to be validated.
        refresh - Refresh the token only if this flag is set to true.
        Returns:
        true if the token is valid, false otherwise
      • refreshSession

        public void refreshSession​(SSOToken token)
                            throws SSOException
        Description copied from interface: SSOProvider
        Refresh the Session corresponding to the SSOToken from the Session Server, always resetting the idle time.
        Specified by:
        refreshSession in interface SSOProvider
        Parameters:
        token - SSOToken
        Throws:
        SSOException - thrown if the session cannot be refreshed for the token
      • refreshSession

        public void refreshSession​(SSOToken token,
                                   boolean resetIdle)
                            throws SSOException
        Description copied from interface: SSOProvider
        Refresh the Session corresponding to the SSOToken from the Session Server, but only optionally resetting the idle time.
        Specified by:
        refreshSession in interface SSOProvider
        Parameters:
        token - SSOToken
        resetIdle - if true, reset the idle time to zero, if false, do not do this.
        Throws:
        SSOException - thrown if the session cannot be refreshed for the token
      • destroyToken

        public void destroyToken​(SSOToken destroyer,
                                 SSOToken destroyed)
                          throws SSOException
        Description copied from interface: SSOProvider
        Destroys an SSOToken.
        Specified by:
        destroyToken in interface SSOProvider
        Parameters:
        destroyer - The SSOToken object used to authorize the operation
        destroyed - The SSOToken object to be destroyed.
        Throws:
        SSOException - thrown if the there was an error during communication with session service.
      • getValidSessions

        public Set<SSOToken> getValidSessions​(SSOToken requester,
                                              String server)
                                       throws SSOException
        Description copied from interface: SSOProvider
        Returns valid Sessions.
        Specified by:
        getValidSessions in interface SSOProvider
        Parameters:
        requester - The SSOToken object used to authorize the operation
        server - The server for which the valid sessions are to be retrieved
        Returns:
        Set The set of Valid Sessions
        Throws:
        SSOException - thrown if the there was an error during communication with session service.
      • schemaChanged

        public void schemaChanged​(String serviceName,
                                  String version)
        Description copied from interface: ServiceListener
        This method will be invoked when a service's schema has been changed.
        Specified by:
        schemaChanged in interface ServiceListener
        Parameters:
        serviceName - name of the service
        version - version of the service
      • globalConfigChanged

        public void globalConfigChanged​(String serviceName,
                                        String version,
                                        String groupName,
                                        String serviceComponent,
                                        int type)
        Description copied from interface: ServiceListener
        This method will be invoked when a service's global configuration data has been changed. The parameter groupName denote the name of the configuration grouping (e.g. default) and serviceComponent denotes the service's sub-component that changed (e.g. /NamedPolicy, /Templates).
        Specified by:
        globalConfigChanged in interface ServiceListener
        Parameters:
        serviceName - name of the service.
        version - version of the service.
        groupName - name of the configuration grouping.
        serviceComponent - name of the service components that changed.
        type - change type, i.e., ADDED, REMOVED or MODIFIED.
      • organizationConfigChanged

        public void organizationConfigChanged​(String serviceName,
                                              String version,
                                              String orgName,
                                              String groupName,
                                              String serviceComponent,
                                              int type)
        Description copied from interface: ServiceListener
        This method will be invoked when a service's organization configuration data has been changed. The parameters orgName, groupName and serviceComponent denotes the organization name, configuration grouping name and service's sub-component that are changed respectively.
        Specified by:
        organizationConfigChanged in interface ServiceListener
        Parameters:
        serviceName - name of the service
        version - version of the service
        orgName - organization name as DN
        groupName - name of the configuration grouping
        serviceComponent - the name of the service components that changed
        type - change type, i.e., ADDED, REMOVED or MODIFIED