-
Aug 16th, 2012, 08:20 AM
#1
How to inject custom WebResponseExceptionTranslator implementation into TokenEndpoin?
Hello everyone,
For some reason I need to return 401.1 HTTP status code instead of default 401 in case of invalid user credentials.
I found that WebResponseExceptionTranslator is responsible for translation OAuth2 exceptions into HTTP statuses.
AFAIK, there is no possibility to configure actual WebResponseExceptionTranslator implementation in oauth2:authorization-server config element.
The only workaround I see here is to inject custom implementation from some bean with dependence on TokenEndpoint like
@Component
@Scope("singleton")
@Lazy(false)
public class ExceptionTranslatorFix implements InitializingBean{
@Autowired
private TokenEndpoint tokenEndpoint;
public afterPropertiesSet(){
Validate.notNull(tokenEndpoint);
tokenEnpoint.setgetExceptionTranslator(customExcep tionTranslator)
}
}
But even this dirty workaround doesn't work because TokenEndpoint has ho setter fo exception translator.
How can I get custom translator injected? Or there is some other way to customize HTTP statuses?
Thanks in advance,
Vitaliy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules