Added logging of error msg to easily identify root cause of failed logins
This commit is contained in:
parent
e4bfbacdd8
commit
aea8a0f537
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.thingsboard.server.service.security.auth.oauth2;
|
package org.thingsboard.server.service.security.auth.oauth2;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.oauth2.client.OAuth2AuthorizedClient;
|
import org.springframework.security.oauth2.client.OAuth2AuthorizedClient;
|
||||||
@ -42,6 +43,7 @@ import java.net.URLEncoder;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Component(value = "oauth2AuthenticationSuccessHandler")
|
@Component(value = "oauth2AuthenticationSuccessHandler")
|
||||||
public class Oauth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
|
public class Oauth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
|
||||||
|
|
||||||
@ -99,6 +101,8 @@ public class Oauth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationS
|
|||||||
clearAuthenticationAttributes(request, response);
|
clearAuthenticationAttributes(request, response);
|
||||||
getRedirectStrategy().sendRedirect(request, response, baseUrl + "/?accessToken=" + accessToken.getToken() + "&refreshToken=" + refreshToken.getToken());
|
getRedirectStrategy().sendRedirect(request, response, baseUrl + "/?accessToken=" + accessToken.getToken() + "&refreshToken=" + refreshToken.getToken());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("Error occurred during processing authentication success result. " +
|
||||||
|
"request [{}], response [{}], authentication [{}]", request, response, authentication, e);
|
||||||
clearAuthenticationAttributes(request, response);
|
clearAuthenticationAttributes(request, response);
|
||||||
String errorPrefix;
|
String errorPrefix;
|
||||||
if (!StringUtils.isEmpty(callbackUrlScheme)) {
|
if (!StringUtils.isEmpty(callbackUrlScheme)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user