Class JDBCLoginService

  • All Implemented Interfaces:
    LoginService, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle

    public class JDBCLoginService
    extends AbstractLoginService
    JDBC as a source of user authentication and authorization information. Uses one database connection that is lazily initialized. Reconnect on failures.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  JDBCLoginService.JDBCUserPrincipal
      JDBCUserPrincipal A UserPrincipal with extra jdbc key info.
      • Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

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

        org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable

        org.eclipse.jetty.util.component.Dumpable.DumpableContainer
      • 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
      java.sql.Connection connectDatabase()
      Connect to database with parameters setup by loadConfig()
      protected void doStart()  
      protected void doStop()  
      java.lang.String getConfig()  
      java.util.List<RolePrincipal> loadRoleInfo​(UserPrincipal user)  
      UserPrincipal loadUserInfo​(java.lang.String username)  
      void setConfig​(java.lang.String config)
      Load JDBC connection configuration from properties file.
      • Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle

        addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeans
      • Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.eclipse.jetty.util.component.Container

        getCachedBeans, getEventListeners
      • Methods inherited from interface org.eclipse.jetty.util.component.Dumpable

        dumpSelf
      • Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer

        isDumpable
    • Field Detail

      • _config

        protected java.lang.String _config
      • _jdbcDriver

        protected java.lang.String _jdbcDriver
      • _url

        protected java.lang.String _url
      • _userName

        protected java.lang.String _userName
      • _password

        protected java.lang.String _password
      • _userTableKey

        protected java.lang.String _userTableKey
      • _userTablePasswordField

        protected java.lang.String _userTablePasswordField
      • _roleTableRoleField

        protected java.lang.String _roleTableRoleField
      • _userSql

        protected java.lang.String _userSql
      • _roleSql

        protected java.lang.String _roleSql
      • _con

        protected java.sql.Connection _con
    • Constructor Detail

      • JDBCLoginService

        public JDBCLoginService()
      • JDBCLoginService

        public JDBCLoginService​(java.lang.String name)
      • JDBCLoginService

        public JDBCLoginService​(java.lang.String name,
                                java.lang.String config)
      • JDBCLoginService

        public JDBCLoginService​(java.lang.String name,
                                IdentityService identityService,
                                java.lang.String config)
    • Method Detail

      • doStart

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

        public java.lang.String getConfig()
      • setConfig

        public void setConfig​(java.lang.String config)
        Load JDBC connection configuration from properties file.
        Parameters:
        config - Filename or url of user properties file.
      • connectDatabase

        public java.sql.Connection connectDatabase()
                                            throws java.sql.SQLException
        Connect to database with parameters setup by loadConfig()
        Throws:
        java.sql.SQLException
      • doStop

        protected void doStop()
                       throws java.lang.Exception
        Overrides:
        doStop in class org.eclipse.jetty.util.component.ContainerLifeCycle
        Throws:
        java.lang.Exception