Set openid scope in OAuth2LoginTests
This commit is contained in:
parent
8f4f52edb9
commit
12f320851d
|
@ -41,7 +41,11 @@ import org.springframework.security.oauth2.core.OAuth2AccessToken;
|
||||||
import org.springframework.security.oauth2.core.TestOAuth2AccessTokens;
|
import org.springframework.security.oauth2.core.TestOAuth2AccessTokens;
|
||||||
import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse;
|
import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse;
|
||||||
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationExchange;
|
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationExchange;
|
||||||
|
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest;
|
||||||
|
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationResponse;
|
||||||
import org.springframework.security.oauth2.core.endpoint.TestOAuth2AuthorizationExchanges;
|
import org.springframework.security.oauth2.core.endpoint.TestOAuth2AuthorizationExchanges;
|
||||||
|
import org.springframework.security.oauth2.core.endpoint.TestOAuth2AuthorizationRequests;
|
||||||
|
import org.springframework.security.oauth2.core.endpoint.TestOAuth2AuthorizationResponses;
|
||||||
import org.springframework.security.oauth2.core.oidc.IdTokenClaimNames;
|
import org.springframework.security.oauth2.core.oidc.IdTokenClaimNames;
|
||||||
import org.springframework.security.oauth2.core.oidc.endpoint.OidcParameterNames;
|
import org.springframework.security.oauth2.core.oidc.endpoint.OidcParameterNames;
|
||||||
import org.springframework.security.oauth2.core.oidc.user.OidcUser;
|
import org.springframework.security.oauth2.core.oidc.user.OidcUser;
|
||||||
|
@ -211,7 +215,9 @@ public class OAuth2LoginTests {
|
||||||
OAuth2LoginWithJwtDecoderFactoryBeanConfig config = this.spring.getContext()
|
OAuth2LoginWithJwtDecoderFactoryBeanConfig config = this.spring.getContext()
|
||||||
.getBean(OAuth2LoginWithJwtDecoderFactoryBeanConfig.class);
|
.getBean(OAuth2LoginWithJwtDecoderFactoryBeanConfig.class);
|
||||||
|
|
||||||
OAuth2AuthorizationExchange exchange = TestOAuth2AuthorizationExchanges.success();
|
OAuth2AuthorizationRequest request = TestOAuth2AuthorizationRequests.request().scope("openid").build();
|
||||||
|
OAuth2AuthorizationResponse response = TestOAuth2AuthorizationResponses.success().build();
|
||||||
|
OAuth2AuthorizationExchange exchange = new OAuth2AuthorizationExchange(request, response);
|
||||||
OAuth2AccessToken accessToken = TestOAuth2AccessTokens.scopes("openid");
|
OAuth2AccessToken accessToken = TestOAuth2AccessTokens.scopes("openid");
|
||||||
OAuth2AuthorizationCodeAuthenticationToken token = new OAuth2AuthorizationCodeAuthenticationToken(google, exchange, accessToken);
|
OAuth2AuthorizationCodeAuthenticationToken token = new OAuth2AuthorizationCodeAuthenticationToken(google, exchange, accessToken);
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ public class TestOAuth2AuthorizationRequests {
|
||||||
return OAuth2AuthorizationRequest.authorizationCode()
|
return OAuth2AuthorizationRequest.authorizationCode()
|
||||||
.authorizationUri("https://example.com/login/oauth/authorize")
|
.authorizationUri("https://example.com/login/oauth/authorize")
|
||||||
.clientId(clientId)
|
.clientId(clientId)
|
||||||
.scope("openid")
|
|
||||||
.redirectUri("https://example.com/authorize/oauth2/code/registration-id")
|
.redirectUri("https://example.com/authorize/oauth2/code/registration-id")
|
||||||
.state("state")
|
.state("state")
|
||||||
.additionalParameters(additionalParameters);
|
.additionalParameters(additionalParameters);
|
||||||
|
|
Loading…
Reference in New Issue