Skip to content

Commit 9de8e13

Browse files
committed
Update reference doc
1 parent a09d099 commit 9de8e13

28 files changed

+373
-93
lines changed

README.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,62 @@ self-contained bootstrap mechanism for the build.
2828

2929
### Checkout sources
3030

31-
```
31+
```bash
3232
git clone https://github.com/webauthn4j/webauthn4j-spring-security
3333
```
3434

3535
### Build all jars
3636

37-
```
37+
```bash
3838
./gradlew build
3939
```
4040

4141
### Execute sample application
4242

43-
```
43+
```bash
4444
./gradlew samples:spa:bootRun
4545
```
4646

4747
![Login view](./docs/src/reference/asciidoc/en/images/login.png "Login view")
4848

49+
## Configuration
50+
51+
WebAuthn4J Spring Security can be configured through Spring Security Java Config.
52+
53+
```java
54+
@Configuration
55+
@EnableWebSecurity
56+
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
57+
58+
@Override
59+
public void configure(AuthenticationManagerBuilder builder) throws Exception {
60+
builder.apply(new WebAuthnAuthenticationProviderConfigurer<>(webAuthnAuthenticatorService, webAuthnManager));
61+
builder.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
62+
}
63+
64+
@Override
65+
protected void configure(HttpSecurity http) throws Exception {
66+
67+
// WebAuthn Login
68+
http.apply(WebAuthnLoginConfigurer.webAuthnLogin())
69+
.defaultSuccessUrl("/", true)
70+
.rpId("example.com")
71+
.attestationOptionsEndpoint()
72+
.rp()
73+
.name("WebAuthn4J Spring Security Sample MPA")
74+
.and()
75+
.pubKeyCredParams(
76+
new PublicKeyCredentialParameters(PublicKeyCredentialType.PUBLIC_KEY, COSEAlgorithmIdentifier.ES256),
77+
new PublicKeyCredentialParameters(PublicKeyCredentialType.PUBLIC_KEY, COSEAlgorithmIdentifier.RS1)
78+
)
79+
.attestation(AttestationConveyancePreference.DIRECT)
80+
.extensions()
81+
.uvm(true)
82+
.credProps(true);
83+
}
84+
}
85+
```
86+
4987

5088
## License
5189

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

Lines changed: 161 additions & 41 deletions
Large diffs are not rendered by default.
2.25 KB
Loading
-38.7 KB
Binary file not shown.
33.2 KB
Loading
-5.39 KB
Loading
7.19 KB
Loading
Binary file not shown.
46 KB
Loading
7.94 KB
Loading

0 commit comments

Comments
 (0)