Skip to content

Commit e1ca76b

Browse files
committed
Renamed WebAuthnAuthenticator to WebAuthnCredentialRecord
1 parent 3930a43 commit e1ca76b

File tree

40 files changed

+399
-398
lines changed

40 files changed

+399
-398
lines changed

docs/src/reference/asciidoc/en/configuration.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ If you set up two-step authentication combined with password authentication, you
9898

9999
==== Persistence layer integration
100100

101-
WebAuthn4J Spring Security looks up an authenticator through the `WebAuthnAuthenticatorService` interface.
102-
Please set a class implementing `WebAuthnAuthenticatorService` to the `WebAuthnAuthenticationProvider`.
101+
WebAuthn4J Spring Security looks up an authenticator through the `WebAuthnCredentialRecordService` interface.
102+
Please set a class implementing `WebAuthnCredentialRecordService` to the `WebAuthnAuthenticationProvider`.
103103
Speaking of Java Config, it can be set through a constructor of `WebAuthnAuthenticationProviderConfigurer`.
104104

105105
=== Client interface

docs/src/reference/asciidoc/ja/configuration.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ Web Authentication用の `AuthenticationProvider` である `WebAuthnAuthenticat
9898

9999
==== 永続化層との統合
100100

101-
WebAuthn4J Spring Securityは `WebAuthnAuthenticatorService` インタフェースを通じて認証デバイスを検索します。
102-
`WebAuthnAuthenticatorService` を実装したクラスを用意し、 `WebAuthnAuthenticationProvider` にセットして下さい。
101+
WebAuthn4J Spring Securityは `WebAuthnCredentialRecordService` インタフェースを通じて認証デバイスを検索します。
102+
`WebAuthnCredentialRecordService` を実装したクラスを用意し、 `WebAuthnAuthenticationProvider` にセットして下さい。
103103

104104
=== クライアントサイドとのインタフェース仕様
105105

samples/fido-server-conformance-test-app/src/main/java/com/webauthn4j/springframework/security/fido/server/endpoint/FidoServerAttestationResultEndpointFilter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import com.webauthn4j.data.attestation.AttestationObject;
2525
import com.webauthn4j.data.client.CollectedClientData;
2626
import com.webauthn4j.springframework.security.WebAuthnRegistrationRequestValidator;
27-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorImpl;
28-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorManager;
27+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordImpl;
28+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordManager;
2929
import com.webauthn4j.springframework.security.fido.server.validator.ServerPublicKeyCredentialValidator;
3030
import org.springframework.security.core.userdetails.UserDetails;
3131
import org.springframework.security.core.userdetails.UserDetailsService;
@@ -47,7 +47,7 @@ public class FidoServerAttestationResultEndpointFilter extends ServerEndpointFil
4747
public static final String FILTER_URL = "/webauthn/attestation/result";
4848

4949
private final UserDetailsService userDetailsService;
50-
private final WebAuthnAuthenticatorManager webAuthnAuthenticatorManager;
50+
private final WebAuthnCredentialRecordManager webAuthnAuthenticatorManager;
5151
private final AttestationObjectConverter attestationObjectConverter;
5252
private final CollectedClientDataConverter collectedClientDataConverter;
5353
private final WebAuthnRegistrationRequestValidator webAuthnRegistrationRequestValidator;
@@ -61,7 +61,7 @@ public class FidoServerAttestationResultEndpointFilter extends ServerEndpointFil
6161
public FidoServerAttestationResultEndpointFilter(
6262
ObjectConverter objectConverter,
6363
UserDetailsService userDetailsService,
64-
WebAuthnAuthenticatorManager webAuthnAuthenticatorManager,
64+
WebAuthnCredentialRecordManager webAuthnAuthenticatorManager,
6565
WebAuthnRegistrationRequestValidator webAuthnRegistrationRequestValidator) {
6666
super(FILTER_URL, objectConverter);
6767
this.attestationObjectConverter = new AttestationObjectConverter(objectConverter);
@@ -115,15 +115,15 @@ protected ServerResponse processRequest(HttpServletRequest request) {
115115
usernameNotFoundHandler.onUsernameNotFound(loginUsername);
116116
}
117117
UserDetails userDetails = userDetailsService.loadUserByUsername(loginUsername);
118-
WebAuthnAuthenticatorImpl webAuthnAuthenticator =
119-
new WebAuthnAuthenticatorImpl(
118+
WebAuthnCredentialRecordImpl webAuthnAuthenticator =
119+
new WebAuthnCredentialRecordImpl(
120120
"Authenticator",
121121
loginUsername,
122122
attestationObject.getAuthenticatorData().getAttestedCredentialData(),
123123
attestationObject.getAttestationStatement(),
124124
attestationObject.getAuthenticatorData().getSignCount()
125125
);
126-
webAuthnAuthenticatorManager.createAuthenticator(webAuthnAuthenticator);
126+
webAuthnAuthenticatorManager.createCredentialRecord(webAuthnAuthenticator);
127127
return new AttestationResultSuccessResponse();
128128
}
129129
catch (DataConversionException e){

samples/fido-server-conformance-test-app/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/app/config/WebSecurityBeanConfig.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
import com.webauthn4j.metadata.anchor.MetadataStatementsBasedTrustAnchorRepository;
2929
import com.webauthn4j.metadata.converter.jackson.WebAuthnMetadataJSONModule;
3030
import com.webauthn4j.springframework.security.WebAuthnRegistrationRequestValidator;
31-
import com.webauthn4j.springframework.security.authenticator.InMemoryWebAuthnAuthenticatorManager;
32-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorManager;
33-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorService;
31+
import com.webauthn4j.springframework.security.credential.InMemoryWebAuthnCredentialRecordManager;
32+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordManager;
33+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordService;
3434
import com.webauthn4j.springframework.security.challenge.ChallengeRepository;
3535
import com.webauthn4j.springframework.security.challenge.HttpSessionChallengeRepository;
3636
import com.webauthn4j.springframework.security.metadata.ResourcesMetadataStatementsProvider;
@@ -77,8 +77,8 @@
7777
public class WebSecurityBeanConfig {
7878

7979
@Bean
80-
public WebAuthnAuthenticatorManager webAuthnAuthenticatorManager(){
81-
return new InMemoryWebAuthnAuthenticatorManager();
80+
public WebAuthnCredentialRecordManager webAuthnAuthenticatorManager(){
81+
return new InMemoryWebAuthnCredentialRecordManager();
8282
}
8383

8484
@Bean
@@ -108,13 +108,13 @@ public RpIdProvider rpIdProvider(){
108108
}
109109

110110
@Bean
111-
public AttestationOptionsProvider attestationOptionsProvider(RpIdProvider rpIdProvider, WebAuthnAuthenticatorService webAuthnAuthenticatorService, ChallengeRepository challengeRepository) {
112-
return new AttestationOptionsProviderImpl(rpIdProvider, webAuthnAuthenticatorService, challengeRepository);
111+
public AttestationOptionsProvider attestationOptionsProvider(RpIdProvider rpIdProvider, WebAuthnCredentialRecordService webAuthnCredentialRecordService, ChallengeRepository challengeRepository) {
112+
return new AttestationOptionsProviderImpl(rpIdProvider, webAuthnCredentialRecordService, challengeRepository);
113113
}
114114

115115
@Bean
116-
public AssertionOptionsProvider assertionOptionsProvider(RpIdProvider rpIdProvider, WebAuthnAuthenticatorService webAuthnAuthenticatorService, ChallengeRepository challengeRepository) {
117-
return new AssertionOptionsProviderImpl(rpIdProvider, webAuthnAuthenticatorService, challengeRepository);
116+
public AssertionOptionsProvider assertionOptionsProvider(RpIdProvider rpIdProvider, WebAuthnCredentialRecordService webAuthnCredentialRecordService, ChallengeRepository challengeRepository) {
117+
return new AssertionOptionsProviderImpl(rpIdProvider, webAuthnCredentialRecordService, challengeRepository);
118118
}
119119

120120
@Bean

samples/fido-server-conformance-test-app/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/app/config/WebSecurityConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import com.webauthn4j.data.attestation.statement.COSEAlgorithmIdentifier;
2424
import com.webauthn4j.springframework.security.WebAuthnAuthenticationProvider;
2525
import com.webauthn4j.springframework.security.WebAuthnRegistrationRequestValidator;
26-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorManager;
27-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorService;
26+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordManager;
27+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordService;
2828
import com.webauthn4j.springframework.security.challenge.ChallengeRepository;
2929
import com.webauthn4j.springframework.security.config.configurers.WebAuthnLoginConfigurer;
3030
import com.webauthn4j.springframework.security.fido.server.endpoint.FidoServerAssertionOptionsEndpointFilter;
@@ -84,13 +84,13 @@
8484
private ServerPropertyProvider serverPropertyProvider;
8585

8686
@Autowired
87-
private WebAuthnAuthenticatorManager webAuthnAuthenticatorManager;
87+
private WebAuthnCredentialRecordManager webAuthnAuthenticatorManager;
8888

8989
@Autowired
9090
private ChallengeRepository challengeRepository;
9191

9292
@Bean
93-
public WebAuthnAuthenticationProvider webAuthnAuthenticationProvider(WebAuthnAuthenticatorService authenticatorService, WebAuthnManager webAuthnManager){
93+
public WebAuthnAuthenticationProvider webAuthnAuthenticationProvider(WebAuthnCredentialRecordService authenticatorService, WebAuthnManager webAuthnManager){
9494
return new WebAuthnAuthenticationProvider(authenticatorService, webAuthnManager);
9595
}
9696

samples/mpa/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/app/config/WebSecurityBeanConfig.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
import com.webauthn4j.metadata.converter.jackson.WebAuthnMetadataJSONModule;
2424
import com.webauthn4j.springframework.security.WebAuthnRegistrationRequestValidator;
2525
import com.webauthn4j.springframework.security.WebAuthnSecurityExpression;
26-
import com.webauthn4j.springframework.security.authenticator.InMemoryWebAuthnAuthenticatorManager;
27-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorManager;
28-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorService;
26+
import com.webauthn4j.springframework.security.credential.InMemoryWebAuthnCredentialRecordManager;
27+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordManager;
28+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordService;
2929
import com.webauthn4j.springframework.security.challenge.ChallengeRepository;
3030
import com.webauthn4j.springframework.security.challenge.HttpSessionChallengeRepository;
3131
import com.webauthn4j.springframework.security.converter.jackson.WebAuthn4JSpringSecurityJSONModule;
@@ -53,8 +53,8 @@ public UserDetailsManager userDetailsManager(){
5353
}
5454

5555
@Bean
56-
public WebAuthnAuthenticatorManager webAuthnAuthenticatorManager(){
57-
return new InMemoryWebAuthnAuthenticatorManager();
56+
public WebAuthnCredentialRecordManager webAuthnAuthenticatorManager(){
57+
return new InMemoryWebAuthnCredentialRecordManager();
5858
}
5959

6060
@Bean
@@ -82,13 +82,13 @@ public ChallengeRepository challengeRepository() {
8282
}
8383

8484
@Bean
85-
public AttestationOptionsProvider attestationOptionsProvider(RpIdProvider rpIdProvider, WebAuthnAuthenticatorService webAuthnAuthenticatorService, ChallengeRepository challengeRepository){
86-
return new AttestationOptionsProviderImpl(rpIdProvider, webAuthnAuthenticatorService, challengeRepository);
85+
public AttestationOptionsProvider attestationOptionsProvider(RpIdProvider rpIdProvider, WebAuthnCredentialRecordService webAuthnCredentialRecordService, ChallengeRepository challengeRepository){
86+
return new AttestationOptionsProviderImpl(rpIdProvider, webAuthnCredentialRecordService, challengeRepository);
8787
}
8888

8989
@Bean
90-
public AssertionOptionsProvider assertionOptionsProvider(RpIdProvider rpIdProvider, WebAuthnAuthenticatorService webAuthnAuthenticatorService, ChallengeRepository challengeRepository) {
91-
return new AssertionOptionsProviderImpl(rpIdProvider, webAuthnAuthenticatorService, challengeRepository);
90+
public AssertionOptionsProvider assertionOptionsProvider(RpIdProvider rpIdProvider, WebAuthnCredentialRecordService webAuthnCredentialRecordService, ChallengeRepository challengeRepository) {
91+
return new AssertionOptionsProviderImpl(rpIdProvider, webAuthnCredentialRecordService, challengeRepository);
9292
}
9393

9494
@Bean

samples/mpa/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/app/config/WebSecurityConfig.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
import com.webauthn4j.data.AttestationConveyancePreference;
2121
import com.webauthn4j.data.PublicKeyCredentialParameters;
2222
import com.webauthn4j.data.PublicKeyCredentialType;
23-
import com.webauthn4j.data.ResidentKeyRequirement;
2423
import com.webauthn4j.data.attestation.statement.COSEAlgorithmIdentifier;
2524
import com.webauthn4j.springframework.security.WebAuthnAuthenticationProvider;
26-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorService;
25+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordService;
2726
import com.webauthn4j.springframework.security.config.configurers.WebAuthnLoginConfigurer;
2827
import org.springframework.beans.factory.annotation.Autowired;
2928
import org.springframework.context.ApplicationContext;
@@ -55,7 +54,7 @@ public class WebSecurityConfig {
5554
private ApplicationContext applicationContext;
5655

5756
@Bean
58-
public WebAuthnAuthenticationProvider webAuthnAuthenticationProvider(WebAuthnAuthenticatorService authenticatorService, WebAuthnManager webAuthnManager){
57+
public WebAuthnAuthenticationProvider webAuthnAuthenticationProvider(WebAuthnCredentialRecordService authenticatorService, WebAuthnManager webAuthnManager){
5958
return new WebAuthnAuthenticationProvider(authenticatorService, webAuthnManager);
6059
}
6160

samples/mpa/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/app/web/WebAuthnSampleController.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import com.webauthn4j.data.client.challenge.Challenge;
2020
import com.webauthn4j.springframework.security.WebAuthnRegistrationRequestValidationResponse;
2121
import com.webauthn4j.springframework.security.WebAuthnRegistrationRequestValidator;
22-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticator;
23-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorImpl;
24-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorManager;
22+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecord;
23+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordImpl;
24+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordManager;
2525
import com.webauthn4j.springframework.security.challenge.ChallengeRepository;
2626
import com.webauthn4j.springframework.security.exception.PrincipalNotFoundException;
2727
import com.webauthn4j.springframework.security.exception.WebAuthnAuthenticationException;
@@ -79,7 +79,7 @@ public class WebAuthnSampleController {
7979
private UserDetailsManager userDetailsManager;
8080

8181
@Autowired
82-
private WebAuthnAuthenticatorManager webAuthnAuthenticatorManager;
82+
private WebAuthnCredentialRecordManager webAuthnAuthenticatorManager;
8383

8484
@Autowired
8585
private WebAuthnRegistrationRequestValidator registrationRequestValidator;
@@ -152,7 +152,7 @@ public String create(HttpServletRequest request, @Valid @ModelAttribute("userFor
152152
}
153153
User user = new User(username, password, authorities);
154154

155-
WebAuthnAuthenticator authenticator = new WebAuthnAuthenticatorImpl(
155+
WebAuthnCredentialRecord authenticator = new WebAuthnCredentialRecordImpl(
156156
"authenticator",
157157
user.getUsername(),
158158
registrationRequestValidationResponse.getAttestationObject().getAuthenticatorData().getAttestedCredentialData(),
@@ -165,7 +165,7 @@ public String create(HttpServletRequest request, @Valid @ModelAttribute("userFor
165165

166166
try {
167167
userDetailsManager.createUser(user);
168-
webAuthnAuthenticatorManager.createAuthenticator(authenticator);
168+
webAuthnAuthenticatorManager.createCredentialRecord(authenticator);
169169
} catch (IllegalArgumentException ex) {
170170
model.addAttribute("errorMessage", "Registration failed. The user may already be registered.");
171171
logger.debug("Registration failed.", ex);
@@ -199,8 +199,8 @@ private List<String> getCredentialIds() {
199199
return Collections.emptyList();
200200
} else {
201201
try {
202-
List<WebAuthnAuthenticator> webAuthnAuthenticators = webAuthnAuthenticatorManager.loadAuthenticatorsByUserPrincipal(principal);
203-
return webAuthnAuthenticators.stream()
202+
List<WebAuthnCredentialRecord> webAuthnCredentialRecords = webAuthnAuthenticatorManager.loadCredentialRecordsByUserPrincipal(principal);
203+
return webAuthnCredentialRecords.stream()
204204
.map(webAuthnAuthenticator -> Base64UrlUtil.encodeToString(webAuthnAuthenticator.getAttestedCredentialData().getCredentialId()))
205205
.collect(Collectors.toList());
206206
} catch (PrincipalNotFoundException e) {

samples/spa/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/app/config/WebSecurityBeanConfig.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import com.webauthn4j.metadata.converter.jackson.WebAuthnMetadataJSONModule;
2424
import com.webauthn4j.springframework.security.WebAuthnRegistrationRequestValidator;
2525
import com.webauthn4j.springframework.security.WebAuthnSecurityExpression;
26-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorService;
26+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordService;
2727
import com.webauthn4j.springframework.security.challenge.ChallengeRepository;
2828
import com.webauthn4j.springframework.security.challenge.HttpSessionChallengeRepository;
2929
import com.webauthn4j.springframework.security.converter.jackson.WebAuthn4JSpringSecurityJSONModule;
@@ -76,15 +76,15 @@ public ChallengeRepository challengeRepository() {
7676
}
7777

7878
@Bean
79-
public AttestationOptionsProvider attestationOptionsProvider(RpIdProvider rpIdProvider, WebAuthnAuthenticatorService webAuthnAuthenticatorService, ChallengeRepository challengeRepository, PublicKeyCredentialUserEntityProvider publicKeyCredentialUserEntityProvider){
80-
AttestationOptionsProviderImpl optionsProviderImpl = new AttestationOptionsProviderImpl(rpIdProvider, webAuthnAuthenticatorService, challengeRepository);
79+
public AttestationOptionsProvider attestationOptionsProvider(RpIdProvider rpIdProvider, WebAuthnCredentialRecordService webAuthnCredentialRecordService, ChallengeRepository challengeRepository, PublicKeyCredentialUserEntityProvider publicKeyCredentialUserEntityProvider){
80+
AttestationOptionsProviderImpl optionsProviderImpl = new AttestationOptionsProviderImpl(rpIdProvider, webAuthnCredentialRecordService, challengeRepository);
8181
optionsProviderImpl.setPublicKeyCredentialUserEntityProvider(publicKeyCredentialUserEntityProvider);
8282
return optionsProviderImpl;
8383
}
8484

8585
@Bean
86-
public AssertionOptionsProvider assertionOptionsProvider(RpIdProvider rpIdProvider, WebAuthnAuthenticatorService webAuthnAuthenticatorService, ChallengeRepository challengeRepository) {
87-
return new AssertionOptionsProviderImpl(rpIdProvider, webAuthnAuthenticatorService, challengeRepository);
86+
public AssertionOptionsProvider assertionOptionsProvider(RpIdProvider rpIdProvider, WebAuthnCredentialRecordService webAuthnCredentialRecordService, ChallengeRepository challengeRepository) {
87+
return new AssertionOptionsProviderImpl(rpIdProvider, webAuthnCredentialRecordService, challengeRepository);
8888
}
8989

9090
@Bean

samples/spa/src/main/java/com/webauthn4j/springframework/security/webauthn/sample/app/config/WebSecurityConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import com.webauthn4j.data.PublicKeyCredentialType;
2222
import com.webauthn4j.data.attestation.statement.COSEAlgorithmIdentifier;
2323
import com.webauthn4j.springframework.security.WebAuthnAuthenticationProvider;
24-
import com.webauthn4j.springframework.security.authenticator.WebAuthnAuthenticatorService;
24+
import com.webauthn4j.springframework.security.credential.WebAuthnCredentialRecordService;
2525
import com.webauthn4j.springframework.security.config.configurers.WebAuthnLoginConfigurer;
2626
import org.springframework.beans.factory.annotation.Autowired;
2727
import org.springframework.context.ApplicationContext;
@@ -79,7 +79,7 @@ public class WebSecurityConfig {
7979
private AuthenticationEntryPoint authenticationEntryPoint;
8080

8181
@Bean
82-
public WebAuthnAuthenticationProvider webAuthnAuthenticationProvider(WebAuthnAuthenticatorService authenticatorService, WebAuthnManager webAuthnManager){
82+
public WebAuthnAuthenticationProvider webAuthnAuthenticationProvider(WebAuthnCredentialRecordService authenticatorService, WebAuthnManager webAuthnManager){
8383
return new WebAuthnAuthenticationProvider(authenticatorService, webAuthnManager);
8484
}
8585

0 commit comments

Comments
 (0)