org.eclipse.jetty.security
类 JDBCLoginService

java.lang.Object
  继承者 org.eclipse.jetty.util.component.AbstractLifeCycle
      继承者 org.eclipse.jetty.security.MappedLoginService
          继承者 org.eclipse.jetty.security.JDBCLoginService
所有已实现的接口:
LoginService, LifeCycle

public class JDBCLoginService
extends MappedLoginService

HashMapped User Realm with JDBC as data source. JDBCLoginService extends HashULoginService and adds a method to fetch user information from database. The login() method checks the inherited Map for the user. If the user is not found, it will fetch details from the database and populate the inherited Map. It then calls the superclass login() method to perform the actual authentication. Periodically (controlled by configuration parameter), internal hashes are cleared. Caching can be disabled by setting cache refresh interval to zero. Uses one database connection that is initialized at startup. Reconnect on failures. authenticate() is 'synchronized'. An example properties file for configuration is in $JETTY_HOME/etc/jdbcRealm.properties

版本:
$Id: JDBCLoginService.java 4792 2009-03-18 21:55:52Z gregw $

嵌套类摘要
 
从类 org.eclipse.jetty.security.MappedLoginService 继承的嵌套类/接口
MappedLoginService.Anonymous, MappedLoginService.KnownUser, MappedLoginService.RolePrincipal, MappedLoginService.UserPrincipal
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的嵌套类/接口
AbstractLifeCycle.AbstractLifeCycleListener
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口
LifeCycle.Listener
 
字段摘要
 
从类 org.eclipse.jetty.security.MappedLoginService 继承的字段
_identityService, _name, _users
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
构造方法摘要
JDBCLoginService()
           
JDBCLoginService(String name)
           
JDBCLoginService(String name, IdentityService identityService, String config)
           
JDBCLoginService(String name, String config)
           
 
方法摘要
 void connectDatabase()
          (re)Connect to database with parameters setup by loadConfig()
protected  void doStart()
           
 String getConfig()
           
protected  UserIdentity loadUser(String username)
           
protected  void loadUsers()
           
 UserIdentity login(String username, Object credentials)
          Login a user.
 void setConfig(String config)
          Load JDBC connection configuration from properties file.
 
从类 org.eclipse.jetty.security.MappedLoginService 继承的方法
doStop, getIdentityService, getName, getUsers, logout, putUser, putUser, removeUser, setIdentityService, setName, setUsers, toString, validate
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

JDBCLoginService

public JDBCLoginService()
                 throws IOException
抛出:
IOException

JDBCLoginService

public JDBCLoginService(String name)
                 throws IOException
抛出:
IOException

JDBCLoginService

public JDBCLoginService(String name,
                        String config)
                 throws IOException
抛出:
IOException

JDBCLoginService

public JDBCLoginService(String name,
                        IdentityService identityService,
                        String config)
                 throws IOException
抛出:
IOException
方法详细信息

doStart

protected void doStart()
                throws Exception
覆盖:
MappedLoginService 中的 doStart
抛出:
Exception
另请参见:
MappedLoginService.doStart()

getConfig

public String getConfig()

setConfig

public void setConfig(String config)
Load JDBC connection configuration from properties file.

参数:
config - Filename or url of user properties file.

connectDatabase

public void connectDatabase()
(re)Connect to database with parameters setup by loadConfig()


login

public UserIdentity login(String username,
                          Object credentials)
从接口 LoginService 复制的描述
Login a user.

指定者:
接口 LoginService 中的 login
覆盖:
MappedLoginService 中的 login
参数:
username - The user name
credentials - The users credentials
返回:
A UserIdentity if the credentials matched, otherwise null
另请参见:
LoginService.login(java.lang.String, java.lang.Object)

loadUsers

protected void loadUsers()
指定者:
MappedLoginService 中的 loadUsers

loadUser

protected UserIdentity loadUser(String username)
指定者:
MappedLoginService 中的 loadUser


Copyright © 2013. All Rights Reserved.