Skip to content

Commit

Permalink
UY-1439 fix 500 error code, switch og level in
Browse files Browse the repository at this point in the history
OAuthTokenStatisticPublisher
  • Loading branch information
ppiernik committed Mar 12, 2024
1 parent 2ef32a9 commit 68d3746
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import pl.edu.icm.unity.engine.api.authn.LoginSession;
import pl.edu.icm.unity.engine.api.idp.statistic.IdpStatisticEvent;
import pl.edu.icm.unity.exceptions.EngineException;
import pl.edu.icm.unity.exceptions.InternalException;
import pl.edu.icm.unity.oauth.as.OAuthASProperties;
import pl.edu.icm.unity.oauth.as.OAuthRequestValidator;
import pl.edu.icm.unity.oauth.as.OAuthSystemAttributesProvider;
Expand Down Expand Up @@ -72,7 +73,7 @@ void reportFailAsLoggedClient()
LoginSession loginSession = InvocationContext.getCurrent().getLoginSession();
if (loginSession == null)
{
log.error("Can not retrieve identity of the OAuth client, skippig error reporting");
log.debug("Can not retrieve identity of the OAuth client, skippig error reporting");
return;
}

Expand All @@ -84,7 +85,7 @@ void reportFailAsLoggedClient()

} catch (Exception e)
{
log.error("Can not retrieving identity of the OAuth client", e);
log.debug("Can not retrieving identity of the OAuth client", e);
return;
}

Expand All @@ -96,7 +97,7 @@ void reportFailAsLoggedClient()
clientName = getClientName(clientEntity);
} catch (Exception e)
{
log.error("Can not retrieving client name attribute of the OAuth client", e);
log.debug("Can not retrieving client name attribute of the OAuth client", e);
return;
}

Expand All @@ -112,8 +113,7 @@ private String getClientName(EntityParam clientEntity)
attrs = unsecureAttributesMan.getAllAttributes(clientEntity, true, oauthGroup, null, false);
} catch (EngineException e)
{
log.error("Problem retrieving attributes of the OAuth client", e);
throw new InternalError("Internal error, can not retrieve OAuth client's data");
throw new InternalException("Internal error, can not retrieve OAuth client's data", e);
}

Optional<AttributeExt> clientNameAttr = attrs.stream()
Expand All @@ -140,7 +140,7 @@ void reportSuccess(String clientUsername, String clientName, EntityParam owner)
new ApplicationId(clientUsername), Instant.now());
} catch (EngineException e)
{
log.error("Can not set last access attribute", e);
log.debug("Can not set last access attribute", e);
}

}
Expand Down Expand Up @@ -175,7 +175,7 @@ private Endpoint getEndpoint()
}
} catch (Exception e)
{
log.error("Can not get relateed OAauth authz endpoint for token endpoint " + endpoint.getName(), e);
log.debug("Can not get relateed OAauth authz endpoint for token endpoint " + endpoint.getName(), e);
return endpoint.getEndpoint();
}
}
Expand Down

0 comments on commit 68d3746

Please sign in to comment.