Class SecuredLoginConfiguration
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.auth.SecuredLoginConfiguration
-
- All Implemented Interfaces:
LoginConfiguration,LoginConfigurationEx,LoginConfigurationUpdate,XmlExternalizable
public class SecuredLoginConfiguration extends Object implements LoginConfigurationEx
- Author:
- Maxim.Manuylov Date: 27.11.12
-
-
Field Summary
-
Fields inherited from interface jetbrains.buildServer.serverSide.auth.LoginConfiguration
DEFAULT_GUEST_USERNAME
-
-
Constructor Summary
Constructors Constructor Description SecuredLoginConfiguration(LoginConfigurationEx delegate, SecurityContextEx securityContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T extends AuthModuleType>
AuthModule<T>addAuthModule(T authModuleType, Map<String,String> properties)Adds specified auth module with properties to list of configured auth modules.AuthModule<LoginModuleDescriptor>addDefaultLoginModule()Adds default login module to list of configured auth modules.voidaddListener(LoginConfigurationListener listener)voidclearConfiguredAuthModules()Clears all configured authentication modules.ConfigurationcreateJAASConfiguration()Deprecated.ConfigurationcreateJAASConfiguration(AuthModule<LoginModuleDescriptor> loginModuleWithProperties)Creates JAAS login configuration for specified login module with properties.AuthModuleTypefindAuthModuleTypeByName(String authModuleTypeName)Returns registered authentication module type with the specified name.StringgetAuthType()Deprecated.BuildAuthenticationModegetBuildAuthenticationMode()Detemines which mode should be used for build authentication.<T extends AuthModuleType>
List<AuthModule<T>>getConfiguredAuthModules(Class<T> baseClass)Returns authentication modules configured in config file.List<AuthModule<LoginModuleDescriptor>>getConfiguredLoginModules()Returns enabled login modules in the order they are specified in config file.<T extends AuthModuleType>
AuthModule<T>getDefaultLoginModule(List<AuthModule<T>> loginModules)booleangetDefaultLoginModuleBooleanPropertyValue(String propertyKey)StringgetGuestUsername()Returns username of the guest userCollection<AuthModuleType>getRegisteredAuthModuleTypes()Returns collection of registered authentication module types.Collection<LoginModuleDescriptor>getRegisteredLoginModules()Returns collection of registered login module descriptors.LoginModuleDescriptorgetSelectedLoginModuleDescriptor()Deprecated.StringgetTextForLoginPage()Returns text to show on the login page.TwoFactorAuthenticationTypegetTwoFactorAuthType()Returns currentTwoFactorAuthenticationTypelonggetTwoFactorGracePeriod()Returns duration of grace period for two-factor authentication.DategetTwoFactorSetupDeadline()Returns deadline for setup of two-factor authentication.booleanisAtLeastOneAuthModuleConfigured(Collection<Class<? extends AuthModuleType>> classes)Returns true if at least one authentication module with one of the specified type classes is configured.<T extends AuthModuleType>
booleanisAuthModuleConfigured(Class<T> clazz)Returns true if authentication module with the specified type class is configured.booleanisDefaultLoginConfigured()Returns true if default login module is configured (authorization via own server database).booleanisFreeRegistrationAllowed()Returns true if free user account registration is allowed.booleanisGuestLoginAllowed()Returns true if guest login is allowed.booleanisLoginFormCollapsed()booleanisOnlyDefaultLoginConfigured()Returns true if default login module is configured (authorization via own server database) and no other login modules are configured.booleanisRootLoginAllowed()Returns true if root login is allowed.booleanisUsersCanChangeOwnPasswords()Returns true if users are allowed to change own passwords for built-in authentication module.voidperformBatchChange(Runnable updateAction)Invokes the specified login configuration update action and firesLoginConfigurationListener.loginConfigurationChanged()event only once at the end.voidreadExternal(org.jdom.Element rootElement)Reads login configuration from "auth-config.xml".voidregisterAuthModuleType(AuthModuleType authModuleType)Registers new authentication modulevoidregisterLoginModule(LoginModuleDescriptor moduleDescriptor)Deprecated.voidremoveListener(LoginConfigurationListener listener)voidsetBuildAuthenticationMode(BuildAuthenticationMode buildAuthenticationMode)Set build authentication mode.voidsetFreeRegistrationAllowed(boolean freeRegistrationAllowed)Enables free user account registration.voidsetGuestLoginAllowed(boolean guestLoginAllowed)Enables guest login.voidsetGuestUsername(String username)Sets username to be used by guest uservoidsetLoginFormCollapsed(boolean collapsed)Sets whether the login form should be collapsed on the login pagevoidsetRootLoginAllowed(boolean rootLoginAllowed)Enables root login.voidsetSelectedLoginModule(LoginModuleDescriptor loginModuleDescriptor)Sets current login module.voidsetTextForLoginPage(String textForLoginPage)Sets text to show on the login page.voidsetTwoFactorAuthType(TwoFactorAuthenticationType twoFactorAuthType)Sets type of two-factor authenticationvoidsetTwoFactorSetupDeadline(Date date)Set deadline for setup of two-factor authentication.voidunregisterAuthModuleType(AuthModuleType authModuleType)Unregisters authentication module which was registered byLoginConfiguration.registerAuthModuleType(jetbrains.buildServer.serverSide.auth.AuthModuleType)voidwriteTo(org.jdom.Element parentElement)Write data to the JDOM element
-
-
-
Constructor Detail
-
SecuredLoginConfiguration
public SecuredLoginConfiguration(@NotNull LoginConfigurationEx delegate, @NotNull SecurityContextEx securityContext)
-
-
Method Detail
-
clearConfiguredAuthModules
public void clearConfiguredAuthModules()
Description copied from interface:LoginConfigurationUpdateClears all configured authentication modules.- Specified by:
clearConfiguredAuthModulesin interfaceLoginConfigurationUpdate
-
readExternal
public void readExternal(@NotNull org.jdom.Element rootElement)Description copied from interface:LoginConfigurationUpdateReads login configuration from "auth-config.xml".- Specified by:
readExternalin interfaceLoginConfigurationUpdate- Parameters:
rootElement- root element from "auth-config.xml"
-
performBatchChange
public void performBatchChange(@NotNull Runnable updateAction)Description copied from interface:LoginConfigurationUpdateInvokes the specified login configuration update action and firesLoginConfigurationListener.loginConfigurationChanged()event only once at the end.- Specified by:
performBatchChangein interfaceLoginConfigurationUpdate- Parameters:
updateAction- action to invoke
-
addAuthModule
@NotNull public <T extends AuthModuleType> AuthModule<T> addAuthModule(@NotNull T authModuleType, @NotNull Map<String,String> properties)
Description copied from interface:LoginConfigurationUpdateAdds specified auth module with properties to list of configured auth modules. CallAuthConfigManager.persistConfiguration()to persist the change.- Specified by:
addAuthModulein interfaceLoginConfigurationUpdate- Parameters:
authModuleType- auth module typeproperties- auth module properties- Returns:
- created auth module
-
addDefaultLoginModule
@TestOnly public AuthModule<LoginModuleDescriptor> addDefaultLoginModule()
Description copied from interface:LoginConfigurationUpdateAdds default login module to list of configured auth modules.- Specified by:
addDefaultLoginModulein interfaceLoginConfigurationUpdate
-
setSelectedLoginModule
@TestOnly public void setSelectedLoginModule(@NotNull LoginModuleDescriptor loginModuleDescriptor)Description copied from interface:LoginConfigurationUpdateSets current login module.- Specified by:
setSelectedLoginModulein interfaceLoginConfigurationUpdate
-
setTextForLoginPage
public void setTextForLoginPage(String textForLoginPage)
Description copied from interface:LoginConfigurationUpdateSets text to show on the login page.- Specified by:
setTextForLoginPagein interfaceLoginConfigurationUpdate
-
setLoginFormCollapsed
public void setLoginFormCollapsed(boolean collapsed)
Description copied from interface:LoginConfigurationUpdateSets whether the login form should be collapsed on the login page- Specified by:
setLoginFormCollapsedin interfaceLoginConfigurationUpdate
-
setGuestUsername
public void setGuestUsername(@NotNull String username)Description copied from interface:LoginConfigurationUpdateSets username to be used by guest user- Specified by:
setGuestUsernamein interfaceLoginConfigurationUpdate
-
setGuestLoginAllowed
public void setGuestLoginAllowed(boolean guestLoginAllowed)
Description copied from interface:LoginConfigurationUpdateEnables guest login.- Specified by:
setGuestLoginAllowedin interfaceLoginConfigurationUpdate
-
setTwoFactorAuthType
public void setTwoFactorAuthType(@NotNull TwoFactorAuthenticationType twoFactorAuthType)Description copied from interface:LoginConfigurationUpdateSets type of two-factor authentication- Specified by:
setTwoFactorAuthTypein interfaceLoginConfigurationUpdate
-
setTwoFactorSetupDeadline
public void setTwoFactorSetupDeadline(@NotNull Date date)Description copied from interface:LoginConfigurationUpdateSet deadline for setup of two-factor authentication. Applicable only in mandatory mode.- Specified by:
setTwoFactorSetupDeadlinein interfaceLoginConfigurationUpdate
-
setBuildAuthenticationMode
public void setBuildAuthenticationMode(@NotNull BuildAuthenticationMode buildAuthenticationMode)Description copied from interface:LoginConfigurationUpdateSet build authentication mode.- Specified by:
setBuildAuthenticationModein interfaceLoginConfigurationUpdate
-
setRootLoginAllowed
@TestOnly public void setRootLoginAllowed(boolean rootLoginAllowed)
Description copied from interface:LoginConfigurationUpdateEnables root login.- Specified by:
setRootLoginAllowedin interfaceLoginConfigurationUpdate
-
setFreeRegistrationAllowed
@TestOnly public void setFreeRegistrationAllowed(boolean freeRegistrationAllowed)
Description copied from interface:LoginConfigurationUpdateEnables free user account registration. Free registration can be enabled only if default login module selected.- Specified by:
setFreeRegistrationAllowedin interfaceLoginConfigurationUpdate
-
registerLoginModule
@Deprecated public void registerLoginModule(@NotNull LoginModuleDescriptor moduleDescriptor)
Deprecated.Description copied from interface:LoginConfigurationRegisters new login module- Specified by:
registerLoginModulein interfaceLoginConfiguration- Parameters:
moduleDescriptor- descriptor of the login module
-
registerAuthModuleType
public void registerAuthModuleType(@NotNull AuthModuleType authModuleType)Description copied from interface:LoginConfigurationRegisters new authentication module- Specified by:
registerAuthModuleTypein interfaceLoginConfiguration- Parameters:
authModuleType- type of the authentication module
-
unregisterAuthModuleType
public void unregisterAuthModuleType(@NotNull AuthModuleType authModuleType)Description copied from interface:LoginConfigurationExUnregisters authentication module which was registered byLoginConfiguration.registerAuthModuleType(jetbrains.buildServer.serverSide.auth.AuthModuleType)- Specified by:
unregisterAuthModuleTypein interfaceLoginConfigurationEx- Parameters:
authModuleType- type of the authentication module
-
isLoginFormCollapsed
public boolean isLoginFormCollapsed()
- Specified by:
isLoginFormCollapsedin interfaceLoginConfigurationEx
-
getTwoFactorAuthType
public TwoFactorAuthenticationType getTwoFactorAuthType()
Description copied from interface:LoginConfigurationExReturns currentTwoFactorAuthenticationType- Specified by:
getTwoFactorAuthTypein interfaceLoginConfigurationEx- Returns:
- two-factor authentication type
-
getTwoFactorSetupDeadline
@Nullable public Date getTwoFactorSetupDeadline()
Description copied from interface:LoginConfigurationExReturns deadline for setup of two-factor authentication. Applicable in mandatory mode only. After the deadline, users without grace period would not be able to log in.- Specified by:
getTwoFactorSetupDeadlinein interfaceLoginConfigurationEx- Returns:
- global deadline for setup of 2FA
-
getTwoFactorGracePeriod
public long getTwoFactorGracePeriod()
Description copied from interface:LoginConfigurationExReturns duration of grace period for two-factor authentication. This duration is used for grace period refreshes, both for single user and for all server users- Specified by:
getTwoFactorGracePeriodin interfaceLoginConfigurationEx- Returns:
- grace period duration, in milliseconds
-
getBuildAuthenticationMode
@NotNull public BuildAuthenticationMode getBuildAuthenticationMode()
Description copied from interface:LoginConfigurationExDetemines which mode should be used for build authentication.- Specified by:
getBuildAuthenticationModein interfaceLoginConfigurationEx
-
getTextForLoginPage
@Nullable public String getTextForLoginPage()
Description copied from interface:LoginConfigurationReturns text to show on the login page.- Specified by:
getTextForLoginPagein interfaceLoginConfiguration- Returns:
- text to show on the login page.
-
isDefaultLoginConfigured
public boolean isDefaultLoginConfigured()
Description copied from interface:LoginConfigurationReturns true if default login module is configured (authorization via own server database).- Specified by:
isDefaultLoginConfiguredin interfaceLoginConfiguration- Returns:
- true if default login module is configured (authorization via own server database).
-
isOnlyDefaultLoginConfigured
public boolean isOnlyDefaultLoginConfigured()
Description copied from interface:LoginConfigurationReturns true if default login module is configured (authorization via own server database) and no other login modules are configured.- Specified by:
isOnlyDefaultLoginConfiguredin interfaceLoginConfiguration- Returns:
- true if default login module is configured
-
isAuthModuleConfigured
public <T extends AuthModuleType> boolean isAuthModuleConfigured(@NotNull Class<T> clazz)
Description copied from interface:LoginConfigurationReturns true if authentication module with the specified type class is configured.- Specified by:
isAuthModuleConfiguredin interfaceLoginConfiguration- Returns:
- true if authentication module with the specified type class is configured
-
isAtLeastOneAuthModuleConfigured
public boolean isAtLeastOneAuthModuleConfigured(@NotNull Collection<Class<? extends AuthModuleType>> classes)Description copied from interface:LoginConfigurationReturns true if at least one authentication module with one of the specified type classes is configured.- Specified by:
isAtLeastOneAuthModuleConfiguredin interfaceLoginConfiguration- Returns:
- true if at least one authentication module with one of the specified type classes is configured
-
getSelectedLoginModuleDescriptor
@Deprecated @NotNull public LoginModuleDescriptor getSelectedLoginModuleDescriptor()
Deprecated.Description copied from interface:LoginConfigurationReturns descriptor of the first configured login module.- Specified by:
getSelectedLoginModuleDescriptorin interfaceLoginConfiguration- Returns:
- descriptor of the first configured login module
-
getConfiguredLoginModules
@NotNull public List<AuthModule<LoginModuleDescriptor>> getConfiguredLoginModules()
Description copied from interface:LoginConfigurationReturns enabled login modules in the order they are specified in config file. Never returns empty list: if no login modules are configured, returns the list that contains only default login module.- Specified by:
getConfiguredLoginModulesin interfaceLoginConfiguration- Returns:
- see above
-
isGuestLoginAllowed
public boolean isGuestLoginAllowed()
Description copied from interface:LoginConfigurationReturns true if guest login is allowed.- Specified by:
isGuestLoginAllowedin interfaceLoginConfiguration- Returns:
- true if guest login is allowed
-
isRootLoginAllowed
public boolean isRootLoginAllowed()
Description copied from interface:LoginConfigurationReturns true if root login is allowed.- Specified by:
isRootLoginAllowedin interfaceLoginConfiguration- Returns:
- true if root login is allowed
-
getGuestUsername
@NotNull public String getGuestUsername()
Description copied from interface:LoginConfigurationReturns username of the guest user- Specified by:
getGuestUsernamein interfaceLoginConfiguration- Returns:
- username of the guest user
-
isFreeRegistrationAllowed
public boolean isFreeRegistrationAllowed()
Description copied from interface:LoginConfigurationReturns true if free user account registration is allowed. Free registration can be enabled only if default login module selected.- Specified by:
isFreeRegistrationAllowedin interfaceLoginConfiguration- Returns:
- true if free user account registration is allowed
-
isUsersCanChangeOwnPasswords
public boolean isUsersCanChangeOwnPasswords()
Description copied from interface:LoginConfigurationReturns true if users are allowed to change own passwords for built-in authentication module.- Specified by:
isUsersCanChangeOwnPasswordsin interfaceLoginConfiguration- Returns:
- see above
-
getRegisteredLoginModules
@NotNull public Collection<LoginModuleDescriptor> getRegisteredLoginModules()
Description copied from interface:LoginConfigurationReturns collection of registered login module descriptors.- Specified by:
getRegisteredLoginModulesin interfaceLoginConfiguration- Returns:
- collection of registered login module descriptors
-
getRegisteredAuthModuleTypes
@NotNull public Collection<AuthModuleType> getRegisteredAuthModuleTypes()
Description copied from interface:LoginConfigurationReturns collection of registered authentication module types.- Specified by:
getRegisteredAuthModuleTypesin interfaceLoginConfiguration- Returns:
- collection of registered authentication module types
-
findAuthModuleTypeByName
@Nullable public AuthModuleType findAuthModuleTypeByName(@NotNull String authModuleTypeName)
Description copied from interface:LoginConfigurationReturns registered authentication module type with the specified name.- Specified by:
findAuthModuleTypeByNamein interfaceLoginConfiguration- Returns:
- type or null if not found
-
createJAASConfiguration
@Deprecated public Configuration createJAASConfiguration()
Deprecated.Description copied from interface:LoginConfigurationCreates JAAS login configuration for first configured login module.- Specified by:
createJAASConfigurationin interfaceLoginConfiguration- Returns:
- JAAS login configuration
-
createJAASConfiguration
@NotNull public Configuration createJAASConfiguration(@NotNull AuthModule<LoginModuleDescriptor> loginModuleWithProperties)
Description copied from interface:LoginConfigurationCreates JAAS login configuration for specified login module with properties.- Specified by:
createJAASConfigurationin interfaceLoginConfiguration- Returns:
- JAAS login configuration
-
getConfiguredAuthModules
@NotNull public <T extends AuthModuleType> List<AuthModule<T>> getConfiguredAuthModules(@Nullable Class<T> baseClass)
Description copied from interface:LoginConfigurationReturns authentication modules configured in config file.- Specified by:
getConfiguredAuthModulesin interfaceLoginConfiguration- Parameters:
baseClass- auth module descriptor base class to filter auth modules or null to return all- Returns:
- see above
-
getAuthType
@Deprecated public final String getAuthType()
Deprecated.Description copied from interface:LoginConfigurationAlways returns "mixed" string.- Specified by:
getAuthTypein interfaceLoginConfiguration- Returns:
- see above
-
writeTo
public void writeTo(org.jdom.Element parentElement)
Description copied from interface:XmlExternalizableWrite data to the JDOM element- Specified by:
writeToin interfaceXmlExternalizable- Parameters:
parentElement- - parent element to write data to
-
addListener
public void addListener(@NotNull LoginConfigurationListener listener)- Specified by:
addListenerin interfaceLoginConfigurationEx
-
removeListener
public void removeListener(@NotNull LoginConfigurationListener listener)- Specified by:
removeListenerin interfaceLoginConfigurationEx
-
getDefaultLoginModuleBooleanPropertyValue
public boolean getDefaultLoginModuleBooleanPropertyValue(@NotNull String propertyKey)- Specified by:
getDefaultLoginModuleBooleanPropertyValuein interfaceLoginConfigurationEx
-
getDefaultLoginModule
@Nullable public <T extends AuthModuleType> AuthModule<T> getDefaultLoginModule(@NotNull List<AuthModule<T>> loginModules)
- Specified by:
getDefaultLoginModulein interfaceLoginConfigurationEx
-
-