myndocs / kotlin-oauth2-server

Flexible OAuth2 server library. Support for multiple frameworks
Apache License 2.0
151 stars 25 forks source link

[suggestion] Extended grant types + grant authorization refactoring #44

Closed palmenhq closed 5 years ago

palmenhq commented 5 years ago

Hi 👋 i figured I would give #43 a stab, so here's a solution + some refactoring.

Basically instead of having one fat class that handles grant types and their different ways of issuing tokens (TokenService) I moved the granting into separate classes (any GrantAuthorizer).

By configuring either allowedGrantAuthorizers or additionalGrantAuthorizers you can set which grant types should be allowed and how to handle them.

This is kind of an own initiative, so feel free to discard if you feel it's the wrong approach or something :)

adhesivee commented 5 years ago

Thanks for your PR. I have some concerns with this, that it leans on reflection and trying to push the implementer with a certain solution, for example shouldValidateScopes. I prefer a free format implementation. If the implementer wants to validate scopes, they could re-create or some common logic should be added as a function to this project.

palmenhq commented 5 years ago

@adhesivee Alright, that makes sense - thanks. Would you say it's worth fixing those things or not really?

adhesivee commented 5 years ago

I am closing this PR. This is now resolved with #45