How to change spring security oauth2 default token endpoint? -
we have spring security oauth2 based application. every thing working fine. failed change default token endpoint "/oauth/token" "/external/oauth/token".
my spring-servlet.xml
<http pattern="/external/oauth/token" create-session="stateless" authentication-manager-ref="clientauthenticationmanager" use-expressions="true" xmlns="http://www.springframework.org/schema/security"> <intercept-url pattern="/external/oauth/token" access="isfullyauthenticated()" /> <anonymous enabled="false" /> <http-basic entry-point-ref="clientauthenticationentrypoint" /> <!-- include if need authenticate clients via request parameters --> <custom-filter ref="clientcredentialstokenendpointfilter" after="basic_auth_filter" /> <access-denied-handler ref="oauthaccessdeniedhandler"/> </http> <oauth:authorization-server client-details-service-ref="clientdetails" token-services-ref="tokenservices" user-approval-handler-ref="userapprovalhandler" token-endpoint-url="/external/oauth/token"> <oauth:authorization-code /> <oauth:implicit /> <oauth:refresh-token /> <oauth:client-credentials /> <oauth:password /> </oauth:authorization-server>
but result when access endpoint is
{ error: "unauthorized" error_description: "an authentication object not found in securitycontext" }
am missing thing ? please suggest.
with version 2.0.5.release or above of spring-security-oauth2
in 1 line in java based configuration, tested , works fine, somehow it's overriding requestmapping value of tokenendpoint class.
@configuration @enableauthorizationserver protected static class authorizationserverconfiguration extends authorizationserverconfigureradapter { @override public void configure(authorizationserverendpointsconfigurer endpoints) throws exception { endpoints .pathmapping("/oauth/token", "<your custom endpoint>") } }
Comments
Post a Comment