Is it possible to disable redirect to oauth2/authorization/{registrationId} in oauth2 client flow? I have following properties for oauth2 flow in Spring Cloud Gateway, but nowhere I didn't specify url oauth2/authorization/{registrationId}:
security:
oauth2:
client:
registration:
smart_hub_client:
provider: wso2is
client-id: someid
client-secret: somesecret
authorization-grant-type: authorization_code
redirect-uri: "{baseUrl}/redirect_uri"
scope: sso,openid
provider:
wso2is:
authorization-uri: https://authserver/oauth2/authorize?loginPage=login.jsp
token-uri: https://authserver.com/oauth2/token
user-info-uri: https://authserver/oauth2/userinfo
user-name-attribute: sub
jwk-set-uri: https://authserver.com/oauth2/jwks
The Request URL from screenshot is here: https://myscgapp/oauth2/authorization/smart_hub_client
UPDATE: I have updated conf from above to my example. The main problem - I have redirect loop. Maybe disabling https://myscgapp/oauth2/authorization/smart_hub_client can help? Or root cause is another?
The
OAuth2AuthorizationRequestRedirectFilter
uses anOAuth2AuthorizationRequestResolver
to initiate the Authorization Code grant flow by redirecting the end-user’s user-agent to the Authorization Server’s authorization endpoint.The default implementation
DefaultOAuth2AuthorizationRequestResolver
matches on the (default) path /oauth2/authorization/{registrationId}.You can customize this by providing a custom
ServerOAuth2AuthorizationRequestResolver
.In the example below, the resolver will match on the path /auth/custom/sso/{registrationId} instead of /oauth2/authorization/{registrationId}.