cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

AuthorizationEndpoint /oauth/authorize controller method is not invoked in storefront extension

Former Member
0 Kudos
448

Hi,

I need to implement/configure OAuth2.0 in the storefront extension. I have updated the storefront's spring-security-config.xml with below configurations for OAuth2.0:

 <bean id="userApprovalHandler" class="com.xxx.storefront.oauth2.MyUserApprovalHandler">
     <property name="autoApproveClients">
         <set>
             <value>sampleclientid</value>
         </set>
     </property>
 </bean>
 
 <oauth:authorization-server client-details-service-ref="clientDetails" user-approval-handler-ref="userApprovalHandler" authorization-endpoint-url="/oauth/authorize">
     <oauth:authorization-code/>
     <oauth:implicit />
     <oauth:refresh-token />
     <oauth:client-credentials />
     <oauth:password />
 </oauth:authorization-server>
 
 <oauth:client-details-service id="clientDetails">

 <oauth:client client-id="sampleclientid" resource-ids="sampleresourceid" scope="extended"
                   authorized-grant-types="authorization_code,refresh_token,password,client_credentials"
                   authorities="ROLE_TRUSTED_CLIENT,ROLE_CLIENT"
                   secret="samplesecret" autoapprove="true" />
 </oauth:client-details-service>

The problem is that the /oauth/authorize controller method in org.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint.java class is not invoked as the DefaultPageController is invoked after successful authentication which treated the call to /oauth/authorize URL as page not found.

Please help how to resolve this issue. Thank you in advance for your help.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member318017
Discoverer
0 Kudos

Auth server is there, but DefaultPageController is executed first. Check the logic of DispatcherServlet - it has a list of mapping types , and mapping for DefaultPageController is found before it can find the mappings for auth server.