[java-idp-plugin-oidc-rp] branch main updated: Allow login_hint parameter in authentication request
Phil Smart
philip.smart at jisc.ac.uk
Tue Mar 14 15:58:56 UTC 2023
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch main
in repository java-idp-plugin-oidc-rp.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-oidc-rp.git;a=commit;h=ec90c7e667f14e2447c48fd75d519b804d5c4025
The following commit(s) were added to refs/heads/main by this push:
new ec90c7e Allow login_hint parameter in authentication request
ec90c7e is described below
commit ec90c7e667f14e2447c48fd75d519b804d5c4025
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Tue Mar 14 15:58:54 2023 +0000
Allow login_hint parameter in authentication request
---
.../authn/oidc/rp/impl/BuildRequestObject.java | 1 +
.../rp/messaging/impl/AddLoginHintHandler.java | 46 ++++++++++++++++++++++
.../oidc/rp/messaging/impl/AddMaxAgeHandler.java | 16 ++++++++
.../oidc-relying-party-authn-beans.xml | 2 +
4 files changed, 65 insertions(+)
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/BuildRequestObject.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/BuildRequestObject.java
index 5d983e1..c6ab747 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/BuildRequestObject.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/BuildRequestObject.java
@@ -241,6 +241,7 @@ public class BuildRequestObject extends AbstractAuthenticationAction {
setClaimIfPresent(requestObjectClaims, "redirect_uri", authnRequest.getRedirectURI());
setClaimIfPresent(requestObjectClaims,"scope", authnRequest.getScope());
setClaimIfPresent(requestObjectClaims, "max_age", authnRequest.getMaxAge());
+ setClaimIfPresent(requestObjectClaims, "login_hint", authnRequest.getLoginHint());
setClaimIfPresent(requestObjectClaims, "prompt", authnRequest.getPrompt());
if (authnRequest.providerSupportsClaimsParameter()) {
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddLoginHintHandler.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddLoginHintHandler.java
new file mode 100644
index 0000000..a14dc89
--- /dev/null
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddLoginHintHandler.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID 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 net.shibboleth.idp.plugin.authn.oidc.rp.messaging.impl;
+
+import javax.annotation.Nonnull;
+
+import org.opensaml.messaging.context.MessageContext;
+import org.opensaml.messaging.handler.MessageHandlerException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/** Message handler that adds the login_hint parameter based on any defined in the profile configuration.*/
+public class AddLoginHintHandler extends AbstractOIDCAuthenticationRequestActionMessageHandler {
+
+ /** Logger. */
+ @Nonnull private final Logger log = LoggerFactory.getLogger(AddLoginHintHandler.class);
+
+ @Override
+ protected void doInvoke(final MessageContext messageContext) throws MessageHandlerException {
+
+ final String loginHint =
+ getProfileConfiguration().getLoginHint(lookupProfileRequestContext(messageContext));
+
+ if (loginHint != null) {
+ log.trace("{} Added login_hint parameter '{}'", getLogPrefix(), loginHint);
+ getAuthenticationRequest().setLoginHint(loginHint);
+ }
+
+ }
+
+}
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddMaxAgeHandler.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddMaxAgeHandler.java
index 2ca4a7c..4c20108 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddMaxAgeHandler.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddMaxAgeHandler.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID 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 net.shibboleth.idp.plugin.authn.oidc.rp.messaging.impl;
diff --git a/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml b/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
index 9c4829b..8ea4172 100644
--- a/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
+++ b/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
@@ -123,6 +123,8 @@
class="net.shibboleth.idp.plugin.authn.oidc.rp.messaging.impl.AddNonceHandler"/>
<bean id="AddEndpointURI" scope="prototype"
class="net.shibboleth.idp.plugin.authn.oidc.rp.messaging.impl.AddEndpointURIHandler"/>
+ <bean id="AddLoginHintHandler" scope="prototype"
+ class="net.shibboleth.idp.plugin.authn.oidc.rp.messaging.impl.AddLoginHintHandler"/>
<bean id="AddRequestedClaims" scope="prototype"
class="net.shibboleth.idp.plugin.authn.oidc.rp.messaging.impl.AddRequestedClaimsHandler"
p:requestedClaimsHook="#{getObject('shibboleth.authn.oidc.rp.RequestedClaimsHook')}" />
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list