[java-idp-plugin-webauthn] branch main updated: Fix registration process. Add properties to properties file
Phil Smart
philip.smart at jisc.ac.uk
Fri Nov 17 10:00:10 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-webauthn.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-webauthn.git;a=commit;h=303e0a201d4c144ffceb6c298109dd0cd88c6155
The following commit(s) were added to refs/heads/main by this push:
new 303e0a2 Fix registration process. Add properties to properties file
303e0a2 is described below
commit 303e0a201d4c144ffceb6c298109dd0cd88c6155
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Nov 17 10:00:03 2023 +0000
Fix registration process. Add properties to properties file
---
.../client/impl/YubicoWebauthnClientFactory.java | 25 +++++++++++++++-------
.../META-INF/net.shibboleth.idp/postconfig.xml | 5 ++++-
.../webauthn-registration-beans.xml | 8 +++----
.../authn/WebAuthn/webauthn-abstract-beans.xml | 12 +++++++----
.../authn/webauthn/conf/authn/webauthn.properties | 3 +++
5 files changed, 36 insertions(+), 17 deletions(-)
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/client/impl/YubicoWebauthnClientFactory.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/client/impl/YubicoWebauthnClientFactory.java
index 3481d49..a03463d 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/client/impl/YubicoWebauthnClientFactory.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/client/impl/YubicoWebauthnClientFactory.java
@@ -19,6 +19,7 @@ import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
+import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.FactoryBean;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -89,7 +90,13 @@ public class YubicoWebauthnClientFactory extends AbstractInitializableComponent
.allowOriginSubdomain(isAllowOriginSubdomain())
.build();
- return new YubicoWebauthnAuthenticationClient(rp, getObjectMapper());
+ assert rp != null;
+ final ObjectMapper localMapper = getObjectMapper();
+ if (localMapper == null) {
+ // Should not happen after init
+ throw new BeanInitializationException("Object mapper can not be null");
+ }
+ return new YubicoWebauthnAuthenticationClient(rp,localMapper);
}
@Override
@@ -108,6 +115,7 @@ public class YubicoWebauthnClientFactory extends AbstractInitializableComponent
* @param objectMapper the object mapper.
*/
public synchronized void setObjectMapper(@Nonnull final ObjectMapper objectMapper) {
+ checkSetterPreconditions();
om = Constraint.isNotNull(objectMapper, "Object mapper can not be null");
}
@@ -117,6 +125,7 @@ public class YubicoWebauthnClientFactory extends AbstractInitializableComponent
* @return the objectMapper;
*/
private synchronized ObjectMapper getObjectMapper() {
+ checkComponentActive();
return om;
}
/**
@@ -125,7 +134,7 @@ public class YubicoWebauthnClientFactory extends AbstractInitializableComponent
* @param relyingPartyIdentifier the relying party identifier.
*/
public synchronized void setRelyingPartyId(@Nonnull final String relyingPartyIdentifier) {
-
+ checkSetterPreconditions();
relyingPartyId = Constraint.isNotNull(relyingPartyIdentifier,"You must set a relying party ID");
}
@@ -148,7 +157,7 @@ public class YubicoWebauthnClientFactory extends AbstractInitializableComponent
* @param relyingPartyIdentifier the relying party name.
*/
public synchronized void setRelyingPartyName(@Nonnull final String name) {
-
+ checkSetterPreconditions();
relyingPartyName = Constraint.isNotNull("You must set a relying party name", name);
}
@@ -158,7 +167,7 @@ public class YubicoWebauthnClientFactory extends AbstractInitializableComponent
* @return the relying party name.
*/
@Nullable private synchronized String getRelyingPartyName() {
-
+ checkComponentActive();
return relyingPartyName;
}
@@ -168,7 +177,7 @@ public class YubicoWebauthnClientFactory extends AbstractInitializableComponent
* @return allow origin port?
*/
private synchronized boolean isAllowOriginPort() {
-
+ checkComponentActive();
return allowOriginPort;
}
@@ -179,7 +188,7 @@ public class YubicoWebauthnClientFactory extends AbstractInitializableComponent
*/
//TODO Javadoc
public synchronized void setAllowOriginPort(final boolean allow) {
-
+ checkSetterPreconditions();
allowOriginPort = allow;
}
@@ -189,7 +198,7 @@ public class YubicoWebauthnClientFactory extends AbstractInitializableComponent
* @return allow subdomains?
*/
private synchronized boolean isAllowOriginSubdomain() {
-
+ checkComponentActive();
return allowOriginSubdomain;
}
@@ -199,7 +208,7 @@ public class YubicoWebauthnClientFactory extends AbstractInitializableComponent
* @param allow are subdomains allowed?
*/
public synchronized void setAllowOriginSubdomain(final boolean allow) {
-
+ checkSetterPreconditions();
allowOriginSubdomain = allow;
}
diff --git a/webauthn-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml b/webauthn-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
index 3396097..6498db1 100644
--- a/webauthn-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
+++ b/webauthn-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
@@ -86,7 +86,10 @@
<!-- Singleton clients -->
<bean id="shibboleth.authn.webauthn.DefaultWebauthnAuthenticationClientFactory" scope="singleton"
class="net.shibboleth.idp.plugin.authn.webauthn.client.impl.YubicoWebauthnClientFactory"
- p:relyingPartyId="localhost" p:relyingPartyName="Shibboleth"
+ p:relyingPartyId="%{idp.authn.webauthn.relyingPartyId}"
+ p:relyingPartyName="Shibboleth"
+ p:allowOriginPort ="%{idp.authn.webauthn.allowOriginPort:false}"
+ p:allowOriginSubdomain ="%{idp.authn.webauthn.allowOriginSubdomain:false}"
p:objectMapper-ref="shibboleth.authn.WebAuthn.JSONObjectMapper" />
<!--
diff --git a/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/admin/webauthn-registration/webauthn-registration-beans.xml b/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/admin/webauthn-registration/webauthn-registration-beans.xml
index ddeb6a4..328de35 100644
--- a/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/admin/webauthn-registration/webauthn-registration-beans.xml
+++ b/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/admin/webauthn-registration/webauthn-registration-beans.xml
@@ -21,20 +21,20 @@
</property>
</bean>
- <bean id="CreatePublicKeyCredentialCreationOptions" scope="prototype"
+ <bean id="CreatePublicKeyCredentialCreationOptions" parent="AbstractWebAuthnAuthenticationAction"
class=" net.shibboleth.idp.plugin.authn.webauthn.impl.CreatePublicKeyCredentialCreationOptions"/>
- <bean id="ExtractPublicKeyCredentialFromFormRequest" scope="prototype"
+ <bean id="ExtractPublicKeyCredentialFromFormRequest" parent="AbstractWebAuthnAuthenticationAction"
class="net.shibboleth.idp.plugin.authn.webauthn.impl.ExtractPublicKeyCredentialFromFormRequest"
p:httpServletRequestSupplier-ref="shibboleth.HttpServletRequestSupplier"
p:objectMapper-ref="shibboleth.authn.WebAuthn.JSONObjectMapper" />
- <bean id="ValidatePublicKeyCredential" scope="prototype"
+ <bean id="ValidatePublicKeyCredential" parent="AbstractWebAuthnAuthenticationAction"
class="net.shibboleth.idp.plugin.authn.webauthn.impl.ValidatePublicKeyCredential" />
- <bean id="StorePublicKeyCredential" scope="prototype"
+ <bean id="StorePublicKeyCredential" parent="AbstractWebAuthnAuthenticationAction"
class="net.shibboleth.idp.plugin.authn.webauthn.storage.impl.StorePublicKeyCredential"
p:storageService-ref="shibboleth.authn.webauthn.StorageService"/>
diff --git a/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/WebAuthn/webauthn-abstract-beans.xml b/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/WebAuthn/webauthn-abstract-beans.xml
index 41b6115..338d3d2 100644
--- a/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/WebAuthn/webauthn-abstract-beans.xml
+++ b/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/WebAuthn/webauthn-abstract-beans.xml
@@ -9,14 +9,18 @@
default-init-method="initialize" default-destroy-method="destroy">
+ <!-- Parent beans -->
<bean id="AbstractPopulateWebauthnAuthenticationContext" scope="prototype" abstract="true"
- class="net.shibboleth.idp.plugin.authn.webauthn.impl.PopulateWebauthnAuthenticationContext"
- p:webauthnClient="#{getObject('shibboleth.authn.webauthn.DefaultWebauthnAuthenticationClientFactory')}"/>
+ class="net.shibboleth.idp.plugin.authn.webauthn.impl.PopulateWebauthnAuthenticationContext"/>
+
+ <bean id="AbstractWebAuthnAuthenticationAction" scope="prototype" abstract="true"
+ p:webAuthnClient="#{getObject('shibboleth.authn.webauthn.DefaultWebauthnAuthenticationClientFactory')}"/>
- <bean id="GenerateServerChallenge" scope="prototype"
+ <!-- Generic beans -->
+ <bean id="GenerateServerChallenge" parent="AbstractWebAuthnAuthenticationAction"
class="net.shibboleth.idp.plugin.authn.webauthn.impl.GenerateServerChallenge" />
-
+
diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn.properties b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn.properties
index e69de29..6e0a26d 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn.properties
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/conf/authn/webauthn.properties
@@ -0,0 +1,3 @@
+idp.authn.webauthn.relyingPartyId = localhost:8443
+idp.authn.webauthn.allowOriginPort = false
+idp.authn.webauthn.allowOriginSubdomain = false
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list