Skip to content
Snippets Groups Projects
Commit b9b8f235 authored by srosse's avatar srosse
Browse files

OO-2342: add more logs error in case the OAuth login process fails

parent 7413dc2d
No related branches found
No related tags found
No related merge requests found
......@@ -143,6 +143,7 @@ public class OAuthDispatcher implements Dispatcher {
OAuthUser infos = provider.getUser(service, accessToken);
if(infos == null || !StringHelper.containsNonWhitespace(infos.getId())) {
error(ureq, translate(ureq, "error.no.id"));
log.error("OAuth Login failed, no infos extracted from access token ");
return;
}
......@@ -154,6 +155,7 @@ public class OAuthDispatcher implements Dispatcher {
register(request, response, registration);
} else {
error(ureq, translate(ureq, "error.account.creation"));
log.error("OAuth Login ok but the user has not an account on OpenOLAT");
}
} else {
if(ureq.getUserSession() != null) {
......@@ -216,6 +218,8 @@ public class OAuthDispatcher implements Dispatcher {
if(identity != null) {
auth = securityManager.createAndPersistAuthentication(identity, registration.getAuthProvider(), id, null, null);
registration.setIdentity(identity);
} else {
log.error("OAuth Login failed, user with user name " + email + " not found.");
}
}
} else {
......
......@@ -101,20 +101,25 @@ public class OpenIdConnectApi extends DefaultApi20 {
boolean allOk = true;
if(!oauthModule.getOpenIdConnectIFIssuer().equals(idJson.get("iss"))) {
allOk &= false;
log.error("iss don't match issuer");
}
if(!oauthModule.getOpenIdConnectIFIssuer().equals(accessJson.get("iss"))) {
allOk &= false;
log.error("iss don't match issuer");
}
if(!oauthModule.getOpenIdConnectIFApiKey().equals(idJson.get("aud"))) {
allOk &= false;
log.error("aud don't match application key");
}
if(!oVerifier.getState().equals(oVerifier.getSessionState())) {
allOk &= false;
log.error("state doesn't match session state");
}
if(!oVerifier.getSessionNonce().equals(idJson.get("nonce"))) {
allOk &= false;
log.error("session nonce don't match verifier nonce");
}
return allOk ? new Token(idToken, oVerifier.getState()) : null;
......
......@@ -103,20 +103,25 @@ public class OpenIdConnectFullConfigurableApi extends DefaultApi20 {
boolean allOk = true;
if(!provider.getIssuer().equals(idJson.get("iss"))) {
allOk &= false;
log.error("iss don't match issuer");
}
if(!provider.getIssuer().equals(accessJson.get("iss"))) {
allOk &= false;
log.error("iss don't match issuer");
}
if(!provider.getAppKey().equals(idJson.get("aud"))) {
allOk &= false;
log.error("aud don't match application key");
}
if(!oVerifier.getState().equals(oVerifier.getSessionState())) {
allOk &= false;
log.error("state doesn't match session state");
}
if(!oVerifier.getSessionNonce().equals(idJson.get("nonce"))) {
allOk &= false;
log.error("session nonce don't match verifier nonce");
}
return allOk ? new Token(idToken, oVerifier.getState()) : null;
......
......@@ -553,7 +553,7 @@ public class OAuthAdminController extends FormBasicController {
private FormLayoutContainer openIdConnectIFCont;
private FormLink deleteButton;
private MultipleSelectionElement openIdConnectIFDefaultEl;
private MultipleSelectionElement openIdConnectIFConfEl;
private TextElement openIdConnectIFConfName;
private TextElement openIdConnectIFConfDisplayName;
private TextElement openIdConnectIFConfApiKeyEl;
......@@ -582,9 +582,9 @@ public class OAuthAdminController extends FormBasicController {
openIdConnectIFCont.setFormTitleIconCss("o_icon o_icon_provider_openid");
openIdConnectIFCont.setRootForm(mainForm);
container.add(openIdConnectIFCont);
openIdConnectIFDefaultEl = uifactory.addCheckboxesHorizontal("openidconnectif." + counter + ".default.enabled", "openidconnectif.default.enabled", openIdConnectIFCont, keys, values);
openIdConnectIFConfEl = uifactory.addCheckboxesHorizontal("openidconnectif." + counter + ".default.enabled", "openidconnectif.default.enabled", openIdConnectIFCont, keys, values);
if(spi.isRootEnabled()) {
openIdConnectIFDefaultEl.select(keys[0], true);
openIdConnectIFConfEl.select(keys[0], true);
}
String providerName = spi.getProviderName();
......@@ -623,7 +623,7 @@ public class OAuthAdminController extends FormBasicController {
String endPoint = openIdConnectIFConfAuthorizationEndPointEl.getValue();
String apiKey = openIdConnectIFConfApiKeyEl.getValue();
String apiSecret = openIdConnectIFConfApiSecretEl.getValue();
boolean rootEnabled = openIdConnectIFDefaultEl.isAtLeastSelected(1);
boolean rootEnabled = openIdConnectIFConfEl.isAtLeastSelected(1);
oauthModule.setAdditionalOpenIDConnectIF(spi.getProviderName(), displayName, rootEnabled, issuer, endPoint, apiKey, apiSecret);
}
}
......
......@@ -94,7 +94,7 @@ public class OAuthAuthenticationController extends FormBasicController implement
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
System.out.println("");
//
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment