Class LoginScreenSupport
java.lang.Object
io.jmix.securityflowui.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 ExtendedClientDetailsProviderprotected AppCookiesprotected CorePropertiesprotected FlowuiPropertiesprotected Messagesprotected org.springframework.security.web.authentication.RememberMeServicesprotected com.vaadin.flow.spring.security.VaadinDefaultRequestCacheprotected ScreenNavigators -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authenticationauthenticate(AuthDetails authDetails) 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 TimeZonedetectTimeZone(com.vaadin.flow.component.page.ExtendedClientDetails details) protected AppCookiesprotected Localeprotected TimeZoneprotected com.vaadin.flow.router.LocationgetRedirectLocation(com.vaadin.flow.server.VaadinServletRequest request, com.vaadin.flow.server.VaadinServletResponse response) protected voidonSuccessfulAuthentication(org.springframework.security.core.Authentication authentication, AuthDetails authDetails) 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) voidsetClientDetailsProvider(ExtendedClientDetailsProvider clientDetailsProvider) voidsetCoreProperties(CoreProperties coreProperties) voidsetFlowuiProperties(FlowuiProperties flowuiProperties) voidsetMessages(Messages messages) voidsetRememberMeServices(org.springframework.security.web.authentication.RememberMeServices rememberMeServices) voidsetRequestCache(com.vaadin.flow.spring.security.VaadinDefaultRequestCache requestCache) voidsetScreenNavigators(ScreenNavigators screenNavigators) protected voidshowInitialScreen(com.vaadin.flow.server.VaadinServletRequest request, com.vaadin.flow.server.VaadinServletResponse response)
-
Field Details
-
authenticationManager
protected org.springframework.security.authentication.AuthenticationManager authenticationManager -
coreProperties
-
flowuiProperties
-
accessManager
-
messages
-
clientDetailsProvider
-
rememberMeServices
protected org.springframework.security.web.authentication.RememberMeServices rememberMeServices -
applicationEventPublisher
protected org.springframework.context.ApplicationEventPublisher applicationEventPublisher -
requestCache
protected com.vaadin.flow.spring.security.VaadinDefaultRequestCache requestCache -
cookies
-
-
Constructor Details
-
LoginScreenSupport
public LoginScreenSupport()
-
-
Method Details
-
setAuthenticationManager
@Autowired public void setAuthenticationManager(org.springframework.security.authentication.AuthenticationManager authenticationManager) -
setCoreProperties
-
setFlowuiProperties
-
setAccessManager
-
setMessages
-
setRememberMeServices
@Autowired public void setRememberMeServices(org.springframework.security.web.authentication.RememberMeServices rememberMeServices) -
setApplicationEventPublisher
@Autowired public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) -
setRequestCache
@Autowired public void setRequestCache(com.vaadin.flow.spring.security.VaadinDefaultRequestCache requestCache) -
setClientDetailsProvider
@Autowired public void setClientDetailsProvider(ExtendedClientDetailsProvider clientDetailsProvider) -
setAuthenticationStrategy
@Autowired(required=false) public void setAuthenticationStrategy(org.springframework.security.web.authentication.session.SessionAuthenticationStrategy authenticationStrategy) -
authenticate
public org.springframework.security.core.Authentication authenticate(AuthDetails authDetails) 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.
- Parameters:
authDetails- authentication details- 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) -
saveCookies
-
checkLoginToUi
protected void checkLoginToUi(AuthDetails authDetails, org.springframework.security.core.Authentication authentication) -
showInitialScreen
protected void showInitialScreen(com.vaadin.flow.server.VaadinServletRequest request, com.vaadin.flow.server.VaadinServletResponse response) -
getRedirectLocation
@Nullable protected com.vaadin.flow.router.Location getRedirectLocation(com.vaadin.flow.server.VaadinServletRequest request, com.vaadin.flow.server.VaadinServletResponse response) -
createAuthenticationToken
-
getDefaultLocale
-
getDeviceTimeZone
-
detectTimeZone
-
getCookies
-