use of com.epam.reportportal.auth.event.UiUserSignedInEvent in project service-authorization by reportportal.
the class AuthSuccessHandler method handle.
@Override
protected void handle(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
OAuth2AccessToken token = getToken(authentication);
MultiValueMap<String, String> query = new LinkedMultiValueMap<>();
query.add("token", token.getValue());
query.add("token_type", token.getTokenType());
URI rqUrl = UriComponentsBuilder.fromHttpRequest(new ServletServerHttpRequest(request)).replacePath("/ui/authSuccess").replaceQueryParams(query).build().toUri();
eventPublisher.publishEvent(new UiUserSignedInEvent(authentication));
getRedirectStrategy().sendRedirect(request, response, rqUrl.toString().replaceFirst("authSuccess", "#authSuccess"));
}
use of com.epam.reportportal.auth.event.UiUserSignedInEvent in project service-authorization by reportportal.
the class EnableableAuthProvider method authenticate.
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
if (isEnabled()) {
Authentication auth = getDelegate().authenticate(authentication);
eventPublisher.publishEvent(new UiUserSignedInEvent(auth));
return auth;
} else {
return null;
}
}
use of com.epam.reportportal.auth.event.UiUserSignedInEvent in project service-authorization by reportportal.
the class BasicPasswordAuthenticationProvider method authenticate.
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
boolean accountNonLocked = !failureEventHandler.isBlocked(request.get());
if (!accountNonLocked) {
BusinessRule.fail().withError(ErrorType.ADDRESS_LOCKED);
}
Authentication auth = super.authenticate(authentication);
eventPublisher.publishEvent(new UiUserSignedInEvent(auth));
return auth;
}
use of com.epam.reportportal.auth.event.UiUserSignedInEvent in project service-authorization by reportportal.
the class OAuthSuccessHandler method handle.
@Override
protected void handle(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
OAuth2Authentication oauth = (OAuth2Authentication) authentication;
OAuth2AccessToken accessToken = tokenServicesFacade.get().createToken(ReportPortalClient.ui, oauth.getName(), oauth.getUserAuthentication(), oauth.getOAuth2Request().getExtensions());
MultiValueMap<String, String> query = new LinkedMultiValueMap<>();
query.add("token", accessToken.getValue());
query.add("token_type", accessToken.getTokenType());
URI rqUrl = UriComponentsBuilder.fromHttpRequest(new ServletServerHttpRequest(request)).replacePath("/ui/authSuccess.html").replaceQueryParams(query).build().toUri();
eventPublisher.publishEvent(new UiUserSignedInEvent(authentication));
getRedirectStrategy().sendRedirect(request, response, rqUrl.toString());
}
use of com.epam.reportportal.auth.event.UiUserSignedInEvent in project service-authorization by reportportal.
the class BasicPasswordAuthenticationProvider method authenticate.
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
boolean accountNonLocked = !failureEventHandler.isBlocked(request.get());
if (!accountNonLocked) {
throw new ReportPortalException(ErrorType.ADDRESS_LOCKED);
}
Authentication auth = super.authenticate(authentication);
eventPublisher.publishEvent(new UiUserSignedInEvent(auth));
return auth;
}
Aggregations