[java-idp-plugin-webauthn] branch main updated: Inject the object mapper into the options creation objects
Phil Smart
philip.smart at jisc.ac.uk
Fri Dec 1 16:16:25 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=cd84d911693e3ac276375a2015bc9df7a263e2ad
The following commit(s) were added to refs/heads/main by this push:
new cd84d91 Inject the object mapper into the options creation objects
cd84d91 is described below
commit cd84d911693e3ac276375a2015bc9df7a263e2ad
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Dec 1 16:16:23 2023 +0000
Inject the object mapper into the options creation objects
---
.../admin/impl/CreatePublicKeyCredentialCreationOptions.java | 10 +++++-----
.../webauthn/impl/CreatePublicKeyCredentialRequestOptions.java | 10 +++++-----
.../impl/ExtractAuthenticatorAssertionFromFormRequest.java | 2 +-
.../webauthn-registration/webauthn-registration-beans.xml | 3 ++-
.../net/shibboleth/idp/flows/authn/WebAuthn/webauthn-beans.xml | 3 ++-
5 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptions.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptions.java
index addcb34..49ac254 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptions.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptions.java
@@ -45,14 +45,14 @@ public class CreatePublicKeyCredentialCreationOptions extends AbstractWebAuthnRe
//TODO move out where we do this
/** The JSON object mapper used to JSONify webauthn objects. */
- @NonnullAfterInit private ObjectMapper jsonObjectMapper;
+ @NonnullAfterInit private ObjectMapper objectMapper;
/** {@inheritDoc} */
@Override
protected void doInitialize() throws ComponentInitializationException {
super.doInitialize();
- if (jsonObjectMapper == null) {
+ if (objectMapper == null) {
throw new ComponentInitializationException("JSON Object Mapper can not be null");
}
}
@@ -63,9 +63,9 @@ public class CreatePublicKeyCredentialCreationOptions extends AbstractWebAuthnRe
*
* @param mapper The jsonObjectMapper to set.
*/
- public void setJsonObjectMapper(@Nonnull final ObjectMapper mapper) {
+ public void setObjectMapper(@Nonnull final ObjectMapper mapper) {
checkSetterPreconditions();
- jsonObjectMapper = Constraint.isNotNull(mapper, "JsonObjectMapper can not be null");
+ objectMapper = Constraint.isNotNull(mapper, "JsonObjectMapper can not be null");
}
@@ -87,7 +87,7 @@ public class CreatePublicKeyCredentialCreationOptions extends AbstractWebAuthnRe
context.setPublicKeyCredentialCreationOptions(pkCredCreationOptions);
//convert to JSON
context.setPublicKeyCredentialCreationOptionsJSON(
- jsonObjectMapper.writeValueAsString(pkCredCreationOptions));
+ objectMapper.writeValueAsString(pkCredCreationOptions));
log.debug("{} Created PublicKeyCredentialCreationOptions '{}'",getLogPrefix(), pkCredCreationOptions);
} catch (final WebAuthnAuthenticationClientException | JsonProcessingException e) {
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java
index 5e6c42f..2a07e07 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java
@@ -46,14 +46,14 @@ public class CreatePublicKeyCredentialRequestOptions extends AbstractWebAuthnAut
//TODO move out where we do this
/** The JSON object mapper used to JSONify webauthn objects. */
- @NonnullAfterInit private ObjectMapper jsonObjectMapper;
+ @NonnullAfterInit private ObjectMapper objectMapper;
/** {@inheritDoc} */
@Override
protected void doInitialize() throws ComponentInitializationException {
super.doInitialize();
- if (jsonObjectMapper == null) {
+ if (objectMapper == null) {
throw new ComponentInitializationException("JSON Object Mapper can not be null");
}
}
@@ -64,9 +64,9 @@ public class CreatePublicKeyCredentialRequestOptions extends AbstractWebAuthnAut
*
* @param mapper The jsonObjectMapper to set.
*/
- public void setJsonObjectMapper(@Nonnull final ObjectMapper mapper) {
+ public void setObjectMapper(@Nonnull final ObjectMapper mapper) {
checkSetterPreconditions();
- jsonObjectMapper = Constraint.isNotNull(mapper, "JsonObjectMapper can not be null");
+ objectMapper = Constraint.isNotNull(mapper, "JsonObjectMapper can not be null");
}
@Override
@@ -89,7 +89,7 @@ public class CreatePublicKeyCredentialRequestOptions extends AbstractWebAuthnAut
client.createAuthenticationRequest(context.getUsername(), null, challenge);
context.setPublicKeyCredentialRequestOptions(pkCredRequestOptions);
- context.setPublicKeyCredentialRequestOptionsJSON(jsonObjectMapper.writeValueAsString(pkCredRequestOptions));
+ context.setPublicKeyCredentialRequestOptionsJSON(objectMapper.writeValueAsString(pkCredRequestOptions));
log.debug("{} Created PublicKeyCredentialRequestOptions: '{}'",getLogPrefix(), pkCredRequestOptions);
} catch (final WebAuthnAuthenticationClientException | JsonProcessingException e) {
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/ExtractAuthenticatorAssertionFromFormRequest.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/ExtractAuthenticatorAssertionFromFormRequest.java
index df8fc73..d9ce6e1 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/ExtractAuthenticatorAssertionFromFormRequest.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/ExtractAuthenticatorAssertionFromFormRequest.java
@@ -102,7 +102,7 @@ public class ExtractAuthenticatorAssertionFromFormRequest extends AbstractWebAut
ActionSupport.buildEvent(profileRequestContext, AuthnEventIds.NO_CREDENTIALS);
return;
}
-
+ // TODO correct object type
final String pkCredJson = extractAuthenticatorAssertionResponse(request);
if (pkCredJson == null) {
log.debug("Public key assertion not found in HTTP request: '{}'",pkCredJson);
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 4734659..2815d08 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
@@ -33,7 +33,8 @@
class="net.shibboleth.idp.plugin.authn.webauthn.admin.impl.GenerateUserHandle" />
<bean id="CreatePublicKeyCredentialCreationOptions" parent="AbstractWebAuthnRegistrationAction"
- class=" net.shibboleth.idp.plugin.authn.webauthn.admin.impl.CreatePublicKeyCredentialCreationOptions" />
+ class=" net.shibboleth.idp.plugin.authn.webauthn.admin.impl.CreatePublicKeyCredentialCreationOptions"
+ p:objectMapper-ref="shibboleth.authn.WebAuthn.JSONObjectMapper"/>
<bean id="ExtractAuthenticatorAttestationFromFormRequest" parent="AbstractWebAuthnRegistrationAction"
class="net.shibboleth.idp.plugin.authn.webauthn.admin.impl.ExtractAuthenticatorAttestationFromFormRequest"
diff --git a/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/WebAuthn/webauthn-beans.xml b/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/WebAuthn/webauthn-beans.xml
index 6a99cc6..9c72842 100644
--- a/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/WebAuthn/webauthn-beans.xml
+++ b/webauthn-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/WebAuthn/webauthn-beans.xml
@@ -26,7 +26,8 @@
</bean>
<bean id="CreatePublicKeyCredentialRequestOptions" parent="AbstractWebAuthnAuthenticationAction"
- class="net.shibboleth.idp.plugin.authn.webauthn.impl.CreatePublicKeyCredentialRequestOptions"/>
+ class="net.shibboleth.idp.plugin.authn.webauthn.impl.CreatePublicKeyCredentialRequestOptions"
+ p:objectMapper-ref="shibboleth.authn.WebAuthn.JSONObjectMapper"/>
<bean id="ExtractAuthenticatorAssertionFromFormRequest" parent="AbstractWebAuthnAuthenticationAction"
class="net.shibboleth.idp.plugin.authn.webauthn.impl.ExtractAuthenticatorAssertionFromFormRequest"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list