Class LoginViewSupport
java.lang.Object
io.jmix.securityflowui.authentication.LoginViewSupport
Class that provides authentication via
AuthenticationManager
. It is intended to use from login view.
Example usage:
@Autowired private LoginViewSupport authenticator; private void doLogin(String username, String password) { loginViewSupport.authenticate( AuthDetails.of(event.getUsername(), event.getPassword()) ); }
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected AccessManager
protected org.springframework.context.ApplicationEventPublisher
protected org.springframework.security.authentication.AuthenticationManager
protected ExtendedClientDetailsProvider
protected AppCookies
protected CoreProperties
protected DeviceTimeZoneProvider
protected Messages
protected org.springframework.security.web.authentication.RememberMeServices
protected com.vaadin.flow.spring.security.VaadinDefaultRequestCache
protected UiProperties
protected ViewNavigators
protected ViewRegistry
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authentication
authenticate
(AuthDetails authDetails) 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 Class<?>
getEntityClass
(ViewInfo viewInfo) protected com.vaadin.flow.router.Location
getRedirectLocation
(com.vaadin.flow.server.VaadinServletRequest request, com.vaadin.flow.server.VaadinServletResponse response) protected boolean
isRedirectToInitialView
(com.vaadin.flow.router.Location redirectLocation) protected void
navigateToDefaultView
(String defaultViewId) protected void
protected void
protected void
onSuccessfulAuthentication
(org.springframework.security.core.Authentication authentication, AuthDetails authDetails) 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
setClientDetailsProvider
(ExtendedClientDetailsProvider clientDetailsProvider) Deprecated, for removal: This API element is subject to removal in a future version.void
setCoreProperties
(CoreProperties coreProperties) void
setDeviceTimeZoneProvider
(DeviceTimeZoneProvider deviceTimeZoneProvider) void
setMessages
(Messages messages) void
setRememberMeServices
(org.springframework.security.web.authentication.RememberMeServices rememberMeServices) void
setRequestCache
(com.vaadin.flow.spring.security.VaadinDefaultRequestCache requestCache) void
setSecurityContextRepository
(org.springframework.security.web.context.SecurityContextRepository securityContextRepository) void
setUiProperties
(UiProperties uiProperties) void
setViewNavigators
(ViewNavigators viewNavigators) void
setViewRegistry
(ViewRegistry viewRegistry) protected void
showInitialView
(com.vaadin.flow.server.VaadinServletRequest request, com.vaadin.flow.server.VaadinServletResponse response)
-
Field Details
-
authenticationManager
protected org.springframework.security.authentication.AuthenticationManager authenticationManager -
coreProperties
-
uiProperties
-
accessManager
-
messages
-
clientDetailsProvider
-
deviceTimeZoneProvider
-
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 -
viewRegistry
-
cookies
-
-
Constructor Details
-
LoginViewSupport
public LoginViewSupport()
-
-
Method Details
-
setSecurityContextRepository
@Autowired public void setSecurityContextRepository(org.springframework.security.web.context.SecurityContextRepository securityContextRepository) -
setAuthenticationManager
@Autowired public void setAuthenticationManager(org.springframework.security.authentication.AuthenticationManager authenticationManager) -
setCoreProperties
-
setUiProperties
-
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
@Deprecated(since="2.4", forRemoval=true) @Autowired public void setClientDetailsProvider(ExtendedClientDetailsProvider clientDetailsProvider) Deprecated, for removal: This API element is subject to removal in a future version.useDeviceTimeZoneProvider
instead -
setDeviceTimeZoneProvider
-
setAuthenticationStrategy
@Autowired(required=false) public void setAuthenticationStrategy(org.springframework.security.web.authentication.session.SessionAuthenticationStrategy authenticationStrategy) -
setViewRegistry
-
authenticate
public org.springframework.security.core.Authentication authenticate(AuthDetails authDetails) 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 view.
- Parameters:
authDetails
- authentication details- 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) -
saveCookies
-
checkLoginToUi
protected void checkLoginToUi(AuthDetails authDetails, org.springframework.security.core.Authentication authentication) -
showInitialView
protected void showInitialView(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) -
isRedirectToInitialView
protected boolean isRedirectToInitialView(com.vaadin.flow.router.Location redirectLocation) -
getEntityClass
-
createAuthenticationToken
-
getDefaultLocale
-
getDeviceTimeZone
-
getCookies
-
DeviceTimeZoneProvider
instead