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.void
addListener(LoginConfigurationListener listener)
void
clearConfiguredAuthModules()
Clears all configured authentication modules.Configuration
createJAASConfiguration()
Deprecated.Configuration
createJAASConfiguration(AuthModule<LoginModuleDescriptor> loginModuleWithProperties)
Creates JAAS login configuration for specified login module with properties.AuthModuleType
findAuthModuleTypeByName(String authModuleTypeName)
Returns registered authentication module type with the specified name.String
getAuthType()
Deprecated.BuildAuthenticationMode
getBuildAuthenticationMode()
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)
boolean
getDefaultLoginModuleBooleanPropertyValue(String propertyKey)
String
getGuestUsername()
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.LoginModuleDescriptor
getSelectedLoginModuleDescriptor()
Deprecated.String
getTextForLoginPage()
Returns text to show on the login page.TwoFactorAuthenticationType
getTwoFactorAuthType()
Returns currentTwoFactorAuthenticationType
long
getTwoFactorGracePeriod()
Returns duration of grace period for two-factor authentication.Date
getTwoFactorSetupDeadline()
Returns deadline for setup of two-factor authentication.boolean
isAtLeastOneAuthModuleConfigured(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.boolean
isDefaultLoginConfigured()
Returns true if default login module is configured (authorization via own server database).boolean
isFreeRegistrationAllowed()
Returns true if free user account registration is allowed.boolean
isGuestLoginAllowed()
Returns true if guest login is allowed.boolean
isLoginFormCollapsed()
boolean
isOnlyDefaultLoginConfigured()
Returns true if default login module is configured (authorization via own server database) and no other login modules are configured.boolean
isRootLoginAllowed()
Returns true if root login is allowed.boolean
isUsersCanChangeOwnPasswords()
Returns true if users are allowed to change own passwords for built-in authentication module.void
performBatchChange(Runnable updateAction)
Invokes the specified login configuration update action and firesLoginConfigurationListener.loginConfigurationChanged()
event only once at the end.void
readExternal(org.jdom.Element rootElement)
Reads login configuration from "auth-config.xml".void
registerAuthModuleType(AuthModuleType authModuleType)
Registers new authentication modulevoid
registerLoginModule(LoginModuleDescriptor moduleDescriptor)
Deprecated.void
removeListener(LoginConfigurationListener listener)
void
setBuildAuthenticationMode(BuildAuthenticationMode buildAuthenticationMode)
Set build authentication mode.void
setFreeRegistrationAllowed(boolean freeRegistrationAllowed)
Enables free user account registration.void
setGuestLoginAllowed(boolean guestLoginAllowed)
Enables guest login.void
setGuestUsername(String username)
Sets username to be used by guest uservoid
setLoginFormCollapsed(boolean collapsed)
Sets whether the login form should be collapsed on the login pagevoid
setRootLoginAllowed(boolean rootLoginAllowed)
Enables root login.void
setSelectedLoginModule(LoginModuleDescriptor loginModuleDescriptor)
Sets current login module.void
setTextForLoginPage(String textForLoginPage)
Sets text to show on the login page.void
setTwoFactorAuthType(TwoFactorAuthenticationType twoFactorAuthType)
Sets type of two-factor authenticationvoid
setTwoFactorSetupDeadline(Date date)
Set deadline for setup of two-factor authentication.void
unregisterAuthModuleType(AuthModuleType authModuleType)
Unregisters authentication module which was registered byLoginConfiguration.registerAuthModuleType(jetbrains.buildServer.serverSide.auth.AuthModuleType)
void
writeTo(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:LoginConfigurationUpdate
Clears all configured authentication modules.- Specified by:
clearConfiguredAuthModules
in interfaceLoginConfigurationUpdate
-
readExternal
public void readExternal(@NotNull org.jdom.Element rootElement)
Description copied from interface:LoginConfigurationUpdate
Reads login configuration from "auth-config.xml".- Specified by:
readExternal
in interfaceLoginConfigurationUpdate
- Parameters:
rootElement
- root element from "auth-config.xml"
-
performBatchChange
public void performBatchChange(@NotNull Runnable updateAction)
Description copied from interface:LoginConfigurationUpdate
Invokes the specified login configuration update action and firesLoginConfigurationListener.loginConfigurationChanged()
event only once at the end.- Specified by:
performBatchChange
in 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:LoginConfigurationUpdate
Adds specified auth module with properties to list of configured auth modules. CallAuthConfigManager.persistConfiguration()
to persist the change.- Specified by:
addAuthModule
in interfaceLoginConfigurationUpdate
- Parameters:
authModuleType
- auth module typeproperties
- auth module properties- Returns:
- created auth module
-
addDefaultLoginModule
@TestOnly public AuthModule<LoginModuleDescriptor> addDefaultLoginModule()
Description copied from interface:LoginConfigurationUpdate
Adds default login module to list of configured auth modules.- Specified by:
addDefaultLoginModule
in interfaceLoginConfigurationUpdate
-
setSelectedLoginModule
@TestOnly public void setSelectedLoginModule(@NotNull LoginModuleDescriptor loginModuleDescriptor)
Description copied from interface:LoginConfigurationUpdate
Sets current login module.- Specified by:
setSelectedLoginModule
in interfaceLoginConfigurationUpdate
-
setTextForLoginPage
public void setTextForLoginPage(String textForLoginPage)
Description copied from interface:LoginConfigurationUpdate
Sets text to show on the login page.- Specified by:
setTextForLoginPage
in interfaceLoginConfigurationUpdate
-
setLoginFormCollapsed
public void setLoginFormCollapsed(boolean collapsed)
Description copied from interface:LoginConfigurationUpdate
Sets whether the login form should be collapsed on the login page- Specified by:
setLoginFormCollapsed
in interfaceLoginConfigurationUpdate
-
setGuestUsername
public void setGuestUsername(@NotNull String username)
Description copied from interface:LoginConfigurationUpdate
Sets username to be used by guest user- Specified by:
setGuestUsername
in interfaceLoginConfigurationUpdate
-
setGuestLoginAllowed
public void setGuestLoginAllowed(boolean guestLoginAllowed)
Description copied from interface:LoginConfigurationUpdate
Enables guest login.- Specified by:
setGuestLoginAllowed
in interfaceLoginConfigurationUpdate
-
setTwoFactorAuthType
public void setTwoFactorAuthType(@NotNull TwoFactorAuthenticationType twoFactorAuthType)
Description copied from interface:LoginConfigurationUpdate
Sets type of two-factor authentication- Specified by:
setTwoFactorAuthType
in interfaceLoginConfigurationUpdate
-
setTwoFactorSetupDeadline
public void setTwoFactorSetupDeadline(@NotNull Date date)
Description copied from interface:LoginConfigurationUpdate
Set deadline for setup of two-factor authentication. Applicable only in mandatory mode.- Specified by:
setTwoFactorSetupDeadline
in interfaceLoginConfigurationUpdate
-
setBuildAuthenticationMode
public void setBuildAuthenticationMode(@NotNull BuildAuthenticationMode buildAuthenticationMode)
Description copied from interface:LoginConfigurationUpdate
Set build authentication mode.- Specified by:
setBuildAuthenticationMode
in interfaceLoginConfigurationUpdate
-
setRootLoginAllowed
@TestOnly public void setRootLoginAllowed(boolean rootLoginAllowed)
Description copied from interface:LoginConfigurationUpdate
Enables root login.- Specified by:
setRootLoginAllowed
in interfaceLoginConfigurationUpdate
-
setFreeRegistrationAllowed
@TestOnly public void setFreeRegistrationAllowed(boolean freeRegistrationAllowed)
Description copied from interface:LoginConfigurationUpdate
Enables free user account registration. Free registration can be enabled only if default login module selected.- Specified by:
setFreeRegistrationAllowed
in interfaceLoginConfigurationUpdate
-
registerLoginModule
@Deprecated public void registerLoginModule(@NotNull LoginModuleDescriptor moduleDescriptor)
Deprecated.Description copied from interface:LoginConfiguration
Registers new login module- Specified by:
registerLoginModule
in interfaceLoginConfiguration
- Parameters:
moduleDescriptor
- descriptor of the login module
-
registerAuthModuleType
public void registerAuthModuleType(@NotNull AuthModuleType authModuleType)
Description copied from interface:LoginConfiguration
Registers new authentication module- Specified by:
registerAuthModuleType
in interfaceLoginConfiguration
- Parameters:
authModuleType
- type of the authentication module
-
unregisterAuthModuleType
public void unregisterAuthModuleType(@NotNull AuthModuleType authModuleType)
Description copied from interface:LoginConfigurationEx
Unregisters authentication module which was registered byLoginConfiguration.registerAuthModuleType(jetbrains.buildServer.serverSide.auth.AuthModuleType)
- Specified by:
unregisterAuthModuleType
in interfaceLoginConfigurationEx
- Parameters:
authModuleType
- type of the authentication module
-
isLoginFormCollapsed
public boolean isLoginFormCollapsed()
- Specified by:
isLoginFormCollapsed
in interfaceLoginConfigurationEx
-
getTwoFactorAuthType
public TwoFactorAuthenticationType getTwoFactorAuthType()
Description copied from interface:LoginConfigurationEx
Returns currentTwoFactorAuthenticationType
- Specified by:
getTwoFactorAuthType
in interfaceLoginConfigurationEx
- Returns:
- two-factor authentication type
-
getTwoFactorSetupDeadline
@Nullable public Date getTwoFactorSetupDeadline()
Description copied from interface:LoginConfigurationEx
Returns 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:
getTwoFactorSetupDeadline
in interfaceLoginConfigurationEx
- Returns:
- global deadline for setup of 2FA
-
getTwoFactorGracePeriod
public long getTwoFactorGracePeriod()
Description copied from interface:LoginConfigurationEx
Returns 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:
getTwoFactorGracePeriod
in interfaceLoginConfigurationEx
- Returns:
- grace period duration, in milliseconds
-
getBuildAuthenticationMode
@NotNull public BuildAuthenticationMode getBuildAuthenticationMode()
Description copied from interface:LoginConfigurationEx
Detemines which mode should be used for build authentication.- Specified by:
getBuildAuthenticationMode
in interfaceLoginConfigurationEx
-
getTextForLoginPage
@Nullable public String getTextForLoginPage()
Description copied from interface:LoginConfiguration
Returns text to show on the login page.- Specified by:
getTextForLoginPage
in interfaceLoginConfiguration
- Returns:
- text to show on the login page.
-
isDefaultLoginConfigured
public boolean isDefaultLoginConfigured()
Description copied from interface:LoginConfiguration
Returns true if default login module is configured (authorization via own server database).- Specified by:
isDefaultLoginConfigured
in interfaceLoginConfiguration
- Returns:
- true if default login module is configured (authorization via own server database).
-
isOnlyDefaultLoginConfigured
public boolean isOnlyDefaultLoginConfigured()
Description copied from interface:LoginConfiguration
Returns true if default login module is configured (authorization via own server database) and no other login modules are configured.- Specified by:
isOnlyDefaultLoginConfigured
in interfaceLoginConfiguration
- Returns:
- true if default login module is configured
-
isAuthModuleConfigured
public <T extends AuthModuleType> boolean isAuthModuleConfigured(@NotNull Class<T> clazz)
Description copied from interface:LoginConfiguration
Returns true if authentication module with the specified type class is configured.- Specified by:
isAuthModuleConfigured
in 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:LoginConfiguration
Returns true if at least one authentication module with one of the specified type classes is configured.- Specified by:
isAtLeastOneAuthModuleConfigured
in 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:LoginConfiguration
Returns descriptor of the first configured login module.- Specified by:
getSelectedLoginModuleDescriptor
in interfaceLoginConfiguration
- Returns:
- descriptor of the first configured login module
-
getConfiguredLoginModules
@NotNull public List<AuthModule<LoginModuleDescriptor>> getConfiguredLoginModules()
Description copied from interface:LoginConfiguration
Returns 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:
getConfiguredLoginModules
in interfaceLoginConfiguration
- Returns:
- see above
-
isGuestLoginAllowed
public boolean isGuestLoginAllowed()
Description copied from interface:LoginConfiguration
Returns true if guest login is allowed.- Specified by:
isGuestLoginAllowed
in interfaceLoginConfiguration
- Returns:
- true if guest login is allowed
-
isRootLoginAllowed
public boolean isRootLoginAllowed()
Description copied from interface:LoginConfiguration
Returns true if root login is allowed.- Specified by:
isRootLoginAllowed
in interfaceLoginConfiguration
- Returns:
- true if root login is allowed
-
getGuestUsername
@NotNull public String getGuestUsername()
Description copied from interface:LoginConfiguration
Returns username of the guest user- Specified by:
getGuestUsername
in interfaceLoginConfiguration
- Returns:
- username of the guest user
-
isFreeRegistrationAllowed
public boolean isFreeRegistrationAllowed()
Description copied from interface:LoginConfiguration
Returns true if free user account registration is allowed. Free registration can be enabled only if default login module selected.- Specified by:
isFreeRegistrationAllowed
in interfaceLoginConfiguration
- Returns:
- true if free user account registration is allowed
-
isUsersCanChangeOwnPasswords
public boolean isUsersCanChangeOwnPasswords()
Description copied from interface:LoginConfiguration
Returns true if users are allowed to change own passwords for built-in authentication module.- Specified by:
isUsersCanChangeOwnPasswords
in interfaceLoginConfiguration
- Returns:
- see above
-
getRegisteredLoginModules
@NotNull public Collection<LoginModuleDescriptor> getRegisteredLoginModules()
Description copied from interface:LoginConfiguration
Returns collection of registered login module descriptors.- Specified by:
getRegisteredLoginModules
in interfaceLoginConfiguration
- Returns:
- collection of registered login module descriptors
-
getRegisteredAuthModuleTypes
@NotNull public Collection<AuthModuleType> getRegisteredAuthModuleTypes()
Description copied from interface:LoginConfiguration
Returns collection of registered authentication module types.- Specified by:
getRegisteredAuthModuleTypes
in interfaceLoginConfiguration
- Returns:
- collection of registered authentication module types
-
findAuthModuleTypeByName
@Nullable public AuthModuleType findAuthModuleTypeByName(@NotNull String authModuleTypeName)
Description copied from interface:LoginConfiguration
Returns registered authentication module type with the specified name.- Specified by:
findAuthModuleTypeByName
in interfaceLoginConfiguration
- Returns:
- type or null if not found
-
createJAASConfiguration
@Deprecated public Configuration createJAASConfiguration()
Deprecated.Description copied from interface:LoginConfiguration
Creates JAAS login configuration for first configured login module.- Specified by:
createJAASConfiguration
in interfaceLoginConfiguration
- Returns:
- JAAS login configuration
-
createJAASConfiguration
@NotNull public Configuration createJAASConfiguration(@NotNull AuthModule<LoginModuleDescriptor> loginModuleWithProperties)
Description copied from interface:LoginConfiguration
Creates JAAS login configuration for specified login module with properties.- Specified by:
createJAASConfiguration
in interfaceLoginConfiguration
- Returns:
- JAAS login configuration
-
getConfiguredAuthModules
@NotNull public <T extends AuthModuleType> List<AuthModule<T>> getConfiguredAuthModules(@Nullable Class<T> baseClass)
Description copied from interface:LoginConfiguration
Returns authentication modules configured in config file.- Specified by:
getConfiguredAuthModules
in 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:LoginConfiguration
Always returns "mixed" string.- Specified by:
getAuthType
in interfaceLoginConfiguration
- Returns:
- see above
-
writeTo
public void writeTo(org.jdom.Element parentElement)
Description copied from interface:XmlExternalizable
Write data to the JDOM element- Specified by:
writeTo
in interfaceXmlExternalizable
- Parameters:
parentElement
- - parent element to write data to
-
addListener
public void addListener(@NotNull LoginConfigurationListener listener)
- Specified by:
addListener
in interfaceLoginConfigurationEx
-
removeListener
public void removeListener(@NotNull LoginConfigurationListener listener)
- Specified by:
removeListener
in interfaceLoginConfigurationEx
-
getDefaultLoginModuleBooleanPropertyValue
public boolean getDefaultLoginModuleBooleanPropertyValue(@NotNull String propertyKey)
- Specified by:
getDefaultLoginModuleBooleanPropertyValue
in interfaceLoginConfigurationEx
-
getDefaultLoginModule
@Nullable public <T extends AuthModuleType> AuthModule<T> getDefaultLoginModule(@NotNull List<AuthModule<T>> loginModules)
- Specified by:
getDefaultLoginModule
in interfaceLoginConfigurationEx
-
-