Skip to content

Commit

Permalink
Logs
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalLike committed Oct 13, 2024
1 parent 717817f commit bb9eb2f
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
import org.springframework.security.oauth2.core.oidc.user.OidcUser;

import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse;
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest;

import java.util.Map;

/**
Expand Down Expand Up @@ -80,10 +83,25 @@ public LoggingOidcAuthorizationCodeAuthenticationProvider(
*/
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
Log.debug(Geonet.SECURITY,"DEBUG HOME MADE " + authentication.getCredentials().toString());
Log.debug(Geonet.SECURITY,"DEBUG HOME MADE " + authentication.getDetails().toString());
Log.debug(Geonet.SECURITY,"---> DEBUG HOME MADE STUFF");
OAuth2LoginAuthenticationToken authorizationCodeAuthentication = (OAuth2LoginAuthenticationToken) authentication;
OAuth2AuthorizationRequest authorizationRequest = authorizationCodeAuthentication.getAuthorizationExchange()
.getAuthorizationRequest();
OAuth2AuthorizationResponse authorizationResponse = authorizationCodeAuthentication.getAuthorizationExchange()
.getAuthorizationResponse();


Log.debug(Geonet.SECURITY,"---> DEBUG HOME MADE STUFF" + authorizationCodeAuthentication.getClientRegistration());
Log.debug(Geonet.SECURITY,"---> DEBUG HOME MADE STUFF" + authorizationCodeAuthentication.getPrincipal());
Log.debug(Geonet.SECURITY,"---> DEBUG HOME MADE STUFF" + authorizationCodeAuthentication.getAccessToken().getTokenValue());
Log.debug(Geonet.SECURITY,"---> DEBUG HOME MADE STUFF" + authorizationCodeAuthentication.getAccessToken().getIssuedAt().toString());
Log.debug(Geonet.SECURITY,"---> DEBUG HOME MADE STUFF" + authorizationCodeAuthentication.getAccessToken().getExpiresAt().toString());
Log.debug(Geonet.SECURITY,"---> DEBUG HOME MADE STUFF" + authorizationResponse.getRedirectUri());
Log.debug(Geonet.SECURITY,"---> DEBUG HOME MADE STUFF" + authorizationResponse.getState());
Log.debug(Geonet.SECURITY,"---> DEBUG HOME MADE STUFF" + authorizationResponse.getCode());


Authentication result = super.authenticate(authentication);
log((OAuth2LoginAuthenticationToken) result);
if (oidcConfiguration.isLogSensitiveInformation() && (authentication instanceof OAuth2LoginAuthenticationToken)) {
log((OAuth2LoginAuthenticationToken) result);
}
Expand Down

0 comments on commit bb9eb2f

Please sign in to comment.