add logging for oauth2 errors (#620)

This commit is contained in:
James Hodgkinson 2021-11-25 14:55:12 +10:00 committed by GitHub
parent fad0dd86e0
commit b7837f3aae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -188,13 +188,15 @@ or with an appropriate include.
OIDCRedirectURI http://resource.example.com/protected/redirect_uri OIDCRedirectURI http://resource.example.com/protected/redirect_uri
OIDCCryptoPassphrase <random password here> OIDCCryptoPassphrase <random password here>
OIDCProviderMetadataURL https://kanidm.example.com/oauth2/openid/<resource server name>/.well-known/openid-configuration OIDCProviderMetadataURL https://kanidm.example.com/oauth2/openid/<resource server name>/.well-known/openid-configuration
OIDCScope "openid other_scopes" OIDCScope "openid"
OIDCUserInfoTokenMethod authz_header OIDCUserInfoTokenMethod authz_header
OIDCClientID <resource server name> OIDCClientID <resource server name>
OIDCClientSecret <resource server password> OIDCClientSecret <resource server password>
OIDCPKCEMethod S256 OIDCPKCEMethod S256
OIDCCookieSameSite On OIDCCookieSameSite On
Other scopes can be added as required to the `OIDCScope` line, eg: `OIDCScope "openid scope2 scope3"`
In the virtual host, to protect a location: In the virtual host, to protect a location:
<Location /> <Location />

View file

@ -241,6 +241,11 @@ async fn oauth2_authorise(
Ok(tide::Response::new(tide::StatusCode::Unauthorized)) Ok(tide::Response::new(tide::StatusCode::Unauthorized))
} }
Err(e) => { Err(e) => {
admin_error!(
"Unable to authorise - Error ID: {} error: {}",
&hvalue,
&e.to_string()
);
redir_url redir_url
.query_pairs_mut() .query_pairs_mut()
.clear() .clear()