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
Modifier and TypeFieldDescriptionprotected AccessManager
protected org.springframework.context.ApplicationEventPublisher
protected org.springframework.security.authentication.AuthenticationManager
protected AppCookies
protected CoreProperties
protected DeviceInfoProvider
protected Messages
protected org.springframework.security.web.authentication.RememberMeServices
protected ScreenBuilders
protected UiProperties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authentication
authenticate
(AuthDetails authDetails, FrameOwner frameOwner) Performs authentication viaAuthenticationManager
and usesUsernamePasswordAuthenticationToken
with credentials fromAuthDetails
.protected void
checkLoginToUi
(AuthDetails authDetails, org.springframework.security.core.Authentication authentication) protected org.springframework.security.core.Authentication
createAuthenticationToken
(String username, String password, Locale locale, TimeZone timeZone) protected AppCookies
protected Locale
protected TimeZone
protected void
onSuccessfulAuthentication
(org.springframework.security.core.Authentication authentication, AuthDetails authDetails, FrameOwner frameOwner) protected void
preventSessionFixation
(org.springframework.security.core.Authentication authentication) protected void
saveCookies
(AuthDetails authDetails) void
setAccessManager
(AccessManager accessManager) void
setApplicationEventPublisher
(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) void
setAuthenticationManager
(org.springframework.security.authentication.AuthenticationManager authenticationManager) void
setAuthenticationStrategy
(org.springframework.security.web.authentication.session.SessionAuthenticationStrategy authenticationStrategy) void
setCoreProperties
(CoreProperties coreProperties) void
setDeviceInfoProvider
(DeviceInfoProvider deviceInfoProvider) void
setMessages
(Messages messages) void
setRememberMeServices
(org.springframework.security.web.authentication.RememberMeServices rememberMeServices) void
setScreenBuilders
(ScreenBuilders screenBuilders) void
setUiProperties
(UiProperties uiProperties) protected void
showMainScreen
(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 viaAuthenticationManager
and usesUsernamePasswordAuthenticationToken
with 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()
fromFrameOwner
if 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
-
preventSessionFixation
protected void preventSessionFixation(org.springframework.security.core.Authentication authentication) -
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
-