Class LoginScreenSupport
java.lang.Object
io.jmix.securityui.authentication.LoginScreenSupport
Class that provides authentication via
AuthenticationManager. It is intended to use from login screen.
Example usage:
@Autowired
private LoginScreenAuthenticator authenticator;
private void doLogin(String username, String password) {
Authentication authentication = authenticationSupport.authenticate(
AuthDetails.of(username, password)
.withLocale(localesField.getValue())
.withRememberMe(rememberMeCheckBox.isChecked()), this);
}
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AccessManagerprotected org.springframework.context.ApplicationEventPublisherprotected org.springframework.security.authentication.AuthenticationManagerprotected AppCookiesprotected CorePropertiesprotected DeviceInfoProviderprotected Messagesprotected org.springframework.security.web.authentication.RememberMeServicesprotected ScreenBuildersprotected UiProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authenticationauthenticate(AuthDetails authDetails, FrameOwner frameOwner) Performs authentication viaAuthenticationManagerand usesUsernamePasswordAuthenticationTokenwith credentials fromAuthDetails.protected voidcheckLoginToUi(AuthDetails authDetails, org.springframework.security.core.Authentication authentication) protected org.springframework.security.core.AuthenticationcreateAuthenticationToken(String username, String password, Locale locale, TimeZone timeZone) protected AppCookiesprotected Localeprotected TimeZoneprotected voidonSuccessfulAuthentication(org.springframework.security.core.Authentication authentication, AuthDetails authDetails, FrameOwner frameOwner) protected voidsaveCookies(AuthDetails authDetails) voidsetAccessManager(AccessManager accessManager) voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) voidsetAuthenticationManager(org.springframework.security.authentication.AuthenticationManager authenticationManager) voidsetAuthenticationStrategy(org.springframework.security.web.authentication.session.SessionAuthenticationStrategy authenticationStrategy) voidsetCoreProperties(CoreProperties coreProperties) voidsetDeviceInfoProvider(DeviceInfoProvider deviceInfoProvider) voidsetMessages(Messages messages) voidsetRememberMeServices(org.springframework.security.web.authentication.RememberMeServices rememberMeServices) voidsetScreenBuilders(ScreenBuilders screenBuilders) voidsetUiProperties(UiProperties uiProperties) protected voidshowMainScreen(FrameOwner frameOwner)
-
Field Details
-
authenticationManager
protected org.springframework.security.authentication.AuthenticationManager authenticationManager -
uiProperties
-
coreProperties
-
screenBuilders
-
accessManager
-
messages
-
deviceInfoProvider
-
rememberMeServices
protected org.springframework.security.web.authentication.RememberMeServices rememberMeServices -
applicationEventPublisher
protected org.springframework.context.ApplicationEventPublisher applicationEventPublisher -
cookies
-
-
Constructor Details
-
LoginScreenSupport
public LoginScreenSupport()
-
-
Method Details
-
setAuthenticationManager
@Autowired public void setAuthenticationManager(org.springframework.security.authentication.AuthenticationManager authenticationManager) -
setUiProperties
-
setCoreProperties
-
setScreenBuilders
-
setAccessManager
-
setMessages
-
setDeviceInfoProvider
-
setRememberMeServices
@Autowired public void setRememberMeServices(org.springframework.security.web.authentication.RememberMeServices rememberMeServices) -
setAuthenticationStrategy
@Autowired(required=false) public void setAuthenticationStrategy(org.springframework.security.web.authentication.session.SessionAuthenticationStrategy authenticationStrategy) -
setApplicationEventPublisher
@Autowired public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) -
authenticate
public org.springframework.security.core.Authentication authenticate(AuthDetails authDetails, @Nullable FrameOwner frameOwner) throws org.springframework.security.core.AuthenticationException Performs authentication viaAuthenticationManagerand usesUsernamePasswordAuthenticationTokenwith credentials fromAuthDetails.If locale is not provided it will use the first locale from
CoreProperties.getAvailableLocales()list.After successful authentication, there will be an attempt to open the main screen using
UiProperties.getMainScreenId()fromFrameOwnerif it is notnull.- Parameters:
authDetails- authentication detailsframeOwner- invoking screen to open main screen- Returns:
- a fully authenticated object including credentials
- Throws:
org.springframework.security.core.AuthenticationException- if exception occurs while authentication process
-
onSuccessfulAuthentication
protected void onSuccessfulAuthentication(org.springframework.security.core.Authentication authentication, AuthDetails authDetails, @Nullable FrameOwner frameOwner) -
saveCookies
-
checkLoginToUi
protected void checkLoginToUi(AuthDetails authDetails, org.springframework.security.core.Authentication authentication) -
showMainScreen
-
createAuthenticationToken
-
getDefaultLocale
-
getDeviceTimeZone
-
getCookies
-