Package org.eclipse.jetty.jaas
Class JAASLoginService
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.jaas.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.LoginServiceJAASLoginService Implementation of jetty's LoginService that works with JAAS for authorization and authentication.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String_callbackHandlerClassprotected javax.security.auth.login.Configuration_configurationprotected JAASUserPrincipal_defaultUserprotected org.eclipse.jetty.security.IdentityService_identityServiceprotected java.lang.String_loginModuleNameprotected java.lang.String_realmNameprotected java.lang.String[]_roleClassNamesstatic java.lang.StringDEFAULT_ROLE_CLASS_NAMEstatic java.lang.String[]DEFAULT_ROLE_CLASS_NAMES
-
Constructor Summary
Constructors Constructor Description JAASLoginService()JAASLoginService(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoStart()javax.security.auth.login.ConfigurationgetConfiguration()protected java.lang.String[]getGroups(javax.security.auth.Subject subject)Get all of the groups for the user.org.eclipse.jetty.security.IdentityServicegetIdentityService()Get the identityService.java.lang.StringgetName()Get the name of the realm.java.lang.String[]getRoleClassNames()org.eclipse.jetty.server.UserIdentitylogin(java.lang.String username, java.lang.Object credentials, javax.servlet.ServletRequest request)voidlogout(org.eclipse.jetty.server.UserIdentity user)voidsetCallbackHandlerClass(java.lang.String classname)voidsetConfiguration(javax.security.auth.login.Configuration configuration)voidsetIdentityService(org.eclipse.jetty.security.IdentityService identityService)Set the identityService.voidsetLoginModuleName(java.lang.String name)Set the name to use to index into the config file of LoginModules.voidsetName(java.lang.String name)Set the name of the realmvoidsetRoleClassNames(java.lang.String[] classnames)booleanvalidate(org.eclipse.jetty.server.UserIdentity user)
-
-
-
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
-
_defaultUser
protected JAASUserPrincipal _defaultUser
-
_identityService
protected org.eclipse.jetty.security.IdentityService _identityService
-
_configuration
protected javax.security.auth.login.Configuration _configuration
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the name of the realm.- Specified by:
getNamein interfaceorg.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- aStringvalue
-
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:
getIdentityServicein interfaceorg.eclipse.jetty.security.LoginService- Returns:
- the identityService
-
setIdentityService
public void setIdentityService(org.eclipse.jetty.security.IdentityService identityService)
Set the identityService.- Specified by:
setIdentityServicein interfaceorg.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- aStringvalue
-
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:
doStartin classorg.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:
loginin interfaceorg.eclipse.jetty.security.LoginService
-
validate
public boolean validate(org.eclipse.jetty.server.UserIdentity user)
- Specified by:
validatein interfaceorg.eclipse.jetty.security.LoginService
-
logout
public void logout(org.eclipse.jetty.server.UserIdentity user)
- Specified by:
logoutin interfaceorg.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
-
-