spring-attic / spring-security-oauth

Support for adding OAuth1(a) and OAuth2 features (consumer and provider) for Spring web applications.
http://github.com/spring-projects/spring-security-oauth
Apache License 2.0
4.69k stars 4.04k forks source link

protected methods on DefaultOAuth2ExceptionRenderer #876

Open Myolnir opened 8 years ago

Myolnir commented 8 years ago

In a recent integration with IFTTT platform I have to create my own ExceptionRenderer but my renderer is basically the same that this DefaultOAuth2ExceptionRenderer I only need modify the public method handleHttpEntityResponse but, despite that the other methods of the default renderer are not protected i am not able to extends and I have to create my renderer with some duplicated code.

Don't you think it would be better made this methods protected or create an abstract parent method?

DeCaMil commented 5 years ago

The DefaultOAuth2ExceptionRenderer class is providing a default behavior. It's not meant to be a base class for building new renderers.

That said, the writeWithMessageConverters looks like it could be reusable. It might make sense to pull writeWithMessageConverters to an AbstractOAuth2ExceptionRenderer as a protected method and have DefaultOAuth2ExceptionRenderer extend that.

Myolnir commented 5 years ago

It was long time ago from this thread;)

I agree with you.

I think the best approach could be create an abstract class and the DefaultOAuth2ExceptionRenderer extends that