rombert commented on code in PR #15:
URL:
https://github.com/apache/sling-org-apache-sling-auth-oauth-client/pull/15#discussion_r2104581605
##########
src/main/java/org/apache/sling/auth/oauth_client/spi/UserInfoProcessor.java:
##########
@@ -17,15 +17,13 @@
*/
package org.apache.sling.auth.oauth_client.spi;
-import com.nimbusds.oauth2.sdk.TokenResponse;
-import com.nimbusds.openid.connect.sdk.claims.UserInfo;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Process the user info received from the identity provider and return the
credentials that will be returned by the authentication handler.
*/
public interface UserInfoProcessor {
- @NotNull OidcAuthCredentials process(@Nullable UserInfo userInfo, @NotNull
TokenResponse tokenResponse,
+ @NotNull OidcAuthCredentials process(@Nullable String userInfo, @NotNull
String tokenResponse,
Review Comment:
I think it would be good to document the String values here; links to the
RFC would IMO be enough.
##########
src/main/java/org/apache/sling/auth/oauth_client/impl/OidcAuthenticationHandler.java:
##########
@@ -159,11 +168,13 @@ public OidcAuthenticationHandler(@Reference(policyOption
= ReferencePolicyOption
this.stateManager = stateManager;
this.idp = config.idp();
this.callbackUri = config.callbackUri();
- this.defaultRedirect = config.defaultRedirect();
Review Comment:
Why did you remove this config setting?
##########
src/main/java/org/apache/sling/auth/oauth_client/impl/SlingUserInfoProcessorImpl.java:
##########
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Sakai Foundation (SF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The SF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.sling.auth.oauth_client.impl;
+
+import com.nimbusds.oauth2.sdk.ParseException;
+import com.nimbusds.oauth2.sdk.TokenResponse;
+import com.nimbusds.openid.connect.sdk.claims.UserInfo;
+import net.minidev.json.JSONObject;
+import net.minidev.json.JSONValue;
+import net.minidev.json.JSONArray;
+import org.apache.sling.auth.oauth_client.spi.OidcAuthCredentials;
+import org.apache.sling.auth.oauth_client.spi.UserInfoProcessor;
+import org.apache.sling.commons.crypto.CryptoService;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferencePolicyOption;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Component(
+ service = UserInfoProcessor.class,
+ immediate = true,
Review Comment:
Do you need immediate here? It will be activated as soon as a reference is
requested. You maybe also want to set the configuration policy to required.
##########
src/main/java/org/apache/sling/auth/oauth_client/ClientConnection.java:
##########
@@ -34,4 +36,10 @@ public interface ClientConnection {
* @return the name of the connection
*/
@NotNull String name();
+ @NotNull String clientId();
Review Comment:
Same comment as in
https://github.com/apache/sling-org-apache-sling-auth-oauth-client/pull/17#discussion_r2099767014
, please don't expose this kind of information in `ClientConnection`
##########
src/main/java/org/apache/sling/auth/oauth_client/impl/OidcAuthenticationHandler.java:
##########
@@ -159,11 +168,13 @@ public OidcAuthenticationHandler(@Reference(policyOption
= ReferencePolicyOption
this.stateManager = stateManager;
this.idp = config.idp();
this.callbackUri = config.callbackUri();
- this.defaultRedirect = config.defaultRedirect();
this.loginCookieManager = loginCookieManager;
this.defaultConnectionName = config.defaultConnectionName();
this.userInfoProcessor = userInfoProcessor;
this.userInfoEnabled = config.userInfoEnabled();
+ this.checkNonce = config.checkNonce();
Review Comment:
I realise I'm being pedantic, but I don't like seeing config options that
should not be there :-) You don't have to remove if you're really sure that
there are going to be non-compliant OIDC server implementations out there we
need to support.
Otherwise I would always keep it enabled because it enhances security and
disabling it would bring no benefit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]