Class JAASLoginService

  • All Implemented Interfaces:
    org.eclipse.jetty.security.LoginService, org.eclipse.jetty.util.component.LifeCycle

    public class JAASLoginService
    extends org.eclipse.jetty.util.component.AbstractLifeCycle
    implements org.eclipse.jetty.security.LoginService
    JAASLoginService Implementation of jetty's LoginService that works with JAAS for authorization and authentication.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

        org.eclipse.jetty.util.component.LifeCycle.Listener
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doStart()  
      javax.security.auth.login.Configuration getConfiguration()  
      protected java.lang.String[] getGroups​(javax.security.auth.Subject subject)
      Get all of the groups for the user.
      org.eclipse.jetty.security.IdentityService getIdentityService()
      Get the identityService.
      java.lang.String getName()
      Get the name of the realm.
      java.lang.String[] getRoleClassNames()  
      org.eclipse.jetty.server.UserIdentity login​(java.lang.String username, java.lang.Object credentials, javax.servlet.ServletRequest request)  
      void logout​(org.eclipse.jetty.server.UserIdentity user)  
      void setCallbackHandlerClass​(java.lang.String classname)  
      void setConfiguration​(javax.security.auth.login.Configuration configuration)  
      void setIdentityService​(org.eclipse.jetty.security.IdentityService identityService)
      Set the identityService.
      void setLoginModuleName​(java.lang.String name)
      Set the name to use to index into the config file of LoginModules.
      void setName​(java.lang.String name)
      Set the name of the realm
      void setRoleClassNames​(java.lang.String[] classnames)  
      boolean validate​(org.eclipse.jetty.server.UserIdentity user)  
      • Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        addLifeCycleListener, doStop, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEFAULT_ROLE_CLASS_NAME

        public static final java.lang.String DEFAULT_ROLE_CLASS_NAME
        See Also:
        Constant Field Values
      • DEFAULT_ROLE_CLASS_NAMES

        public static final java.lang.String[] DEFAULT_ROLE_CLASS_NAMES
      • _roleClassNames

        protected java.lang.String[] _roleClassNames
      • _callbackHandlerClass

        protected java.lang.String _callbackHandlerClass
      • _realmName

        protected java.lang.String _realmName
      • _loginModuleName

        protected java.lang.String _loginModuleName
      • _identityService

        protected org.eclipse.jetty.security.IdentityService _identityService
      • _configuration

        protected javax.security.auth.login.Configuration _configuration
    • Constructor Detail

      • JAASLoginService

        public JAASLoginService()
      • JAASLoginService

        public JAASLoginService​(java.lang.String name)
        Parameters:
        name - the name of the realm
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the name of the realm.
        Specified by:
        getName in interface org.eclipse.jetty.security.LoginService
        Returns:
        name or null if not set.
      • setName

        public void setName​(java.lang.String name)
        Set the name of the realm
        Parameters:
        name - a String value
      • getConfiguration

        public javax.security.auth.login.Configuration getConfiguration()
        Returns:
        the configuration
      • setConfiguration

        public void setConfiguration​(javax.security.auth.login.Configuration configuration)
        Parameters:
        configuration - the configuration to set
      • getIdentityService

        public org.eclipse.jetty.security.IdentityService getIdentityService()
        Get the identityService.
        Specified by:
        getIdentityService in interface org.eclipse.jetty.security.LoginService
        Returns:
        the identityService
      • setIdentityService

        public void setIdentityService​(org.eclipse.jetty.security.IdentityService identityService)
        Set the identityService.
        Specified by:
        setIdentityService in interface org.eclipse.jetty.security.LoginService
        Parameters:
        identityService - the identityService to set
      • setLoginModuleName

        public void setLoginModuleName​(java.lang.String name)
        Set the name to use to index into the config file of LoginModules.
        Parameters:
        name - a String value
      • setCallbackHandlerClass

        public void setCallbackHandlerClass​(java.lang.String classname)
      • setRoleClassNames

        public void setRoleClassNames​(java.lang.String[] classnames)
      • getRoleClassNames

        public java.lang.String[] getRoleClassNames()
      • doStart

        protected void doStart()
                        throws java.lang.Exception
        Overrides:
        doStart in class org.eclipse.jetty.util.component.AbstractLifeCycle
        Throws:
        java.lang.Exception
      • login

        public org.eclipse.jetty.server.UserIdentity login​(java.lang.String username,
                                                           java.lang.Object credentials,
                                                           javax.servlet.ServletRequest request)
        Specified by:
        login in interface org.eclipse.jetty.security.LoginService
      • validate

        public boolean validate​(org.eclipse.jetty.server.UserIdentity user)
        Specified by:
        validate in interface org.eclipse.jetty.security.LoginService
      • logout

        public void logout​(org.eclipse.jetty.server.UserIdentity user)
        Specified by:
        logout in interface org.eclipse.jetty.security.LoginService
      • getGroups

        protected java.lang.String[] getGroups​(javax.security.auth.Subject subject)
        Get all of the groups for the user.
        Parameters:
        subject - the Subject representing the user
        Returns:
        all the names of groups that the user is in, or 0 length array if none