Skip to content

Commit a49a5db

Browse files
committed
Polish How-to Customize UserInfo response
Issue gh-537
1 parent 4cf7dd5 commit a49a5db

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/src/docs/asciidoc/examples/src/main/java/sample/userinfo/jwt/JwtUserInfoMapperSecurityConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws
113113
return http.build();
114114
}
115115

116-
@Bean // <3>
116+
@Bean // <4>
117117
public JwtDecoder jwtDecoder(JWKSource<SecurityContext> jwkSource) {
118118
return OAuth2AuthorizationServerConfiguration.jwtDecoder(jwkSource);
119119
}
@@ -168,7 +168,7 @@ public JWKSource<SecurityContext> jwkSource() {
168168
return new ImmutableJWKSet<>(jwkSet);
169169
}
170170

171-
private static KeyPair generateRsaKey() { // <6>
171+
private static KeyPair generateRsaKey() {
172172
KeyPair keyPair;
173173
try {
174174
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");

docs/src/docs/asciidoc/guides/how-to-userinfo.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:index-link: ../how-to.html
44
:docs-dir: ..
55

6-
This guide shows how to customize the xref:{docs-dir}/protocol-endpoints.adoc#oidc-user-info-endpoint[User Info endpoint] of the xref:{docs-dir}/index.adoc#top[Spring Authorization Server].
6+
This guide shows how to customize the xref:{docs-dir}/protocol-endpoints.adoc#oidc-user-info-endpoint[UserInfo endpoint] of the xref:{docs-dir}/index.adoc#top[Spring Authorization Server].
77
The purpose of this guide is to demonstrate how to enable the endpoint and use the available customization options to produce a custom response.
88

99
* <<enable-user-info>>
@@ -16,7 +16,7 @@ The xref:{docs-dir}/protocol-endpoints.adoc#oidc-user-info-endpoint[OpenID Conne
1616

1717
> The Access Token obtained from an OpenID Connect Authentication Request MUST be sent as a Bearer Token, per Section 2 of https://openid.net/specs/openid-connect-core-1_0.html#RFC6750[OAuth 2.0 Bearer Token Usage] [RFC6750].
1818

19-
Before customizing the response, you need to enable the User Info endpoint.
19+
Before customizing the response, you need to enable the UserInfo endpoint.
2020
The following listing shows how to enable the {spring-security-reference-base-url}/servlet/oauth2/resource-server/jwt.html[OAuth2 resource server configuration].
2121

2222
[[sample.userinfo]]
@@ -52,7 +52,7 @@ include::code:IdTokenCustomizerConfig[]
5252

5353
This configuration provides the following:
5454

55-
<1> An instance of `OAuth2TokenCustomizer` for customizing the `id_token`.
55+
<1> An instance of xref:{docs-dir}/core-model-components.adoc#oauth2-token-customizer[`OAuth2TokenCustomizer`] for customizing the `id_token`.
5656
<2> A custom service used to obtain user info in a domain-specific way.
5757

5858
The following listing shows a custom service for looking up user info in a domain-specific way:
@@ -63,7 +63,7 @@ include::code:OidcUserInfoService[]
6363
=== Customize the User Info Mapper
6464

6565
To fully customize the user info response, you can provide a custom user info mapper capable of generating the object used to render the response, which is an instance of the `OidcUserInfo` class from Spring Security.
66-
The mapper implementation receives an instance of `OidcUserInfoAuthenticationContext` with information about the current request, including the xref:{docs-dir}/core-model-components.adoc#oauth2-authorization-service[`OAuth2Authorization`].
66+
The mapper implementation receives an instance of `OidcUserInfoAuthenticationContext` with information about the current request, including the xref:{docs-dir}/core-model-components.adoc#oauth2-authorization[`OAuth2Authorization`].
6767

6868
The following listing shows how to use the customization option that is available while working directly with the `OAuth2AuthorizationServerConfigurer`.
6969

0 commit comments

Comments
 (0)