-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to auth #30
Comments
Hi, i can pre-release a full OAuth server implementation i have been working on. It is not exactly maintainable enough to be production ready, but it is spec compliant. No resource server Library exists for ktor currently, only the client lib provided by ktor and the auth library provided my myndocs. The scope of this library is only to provide a connector, the auth provider, to create the appropriate OpenAPI descriptor. |
Oh, thank you, that will be great. Can I have a look? |
i got to separate the codebase from the main project first, it may take a few hours. |
https://github.com/papsign/KtorOAuthServer/tree/master |
https://github.com/papsign/KtorOAuthServer/tree/master/src/test/kotlin/com/papsign/oauth2/example inline fun NormalOpenAPIRoute.oauth2(vararg scopes: OAuthScope, crossinline route: OpenAPIAuthenticatedRoute<APIPrincipal>.()->Unit = {}): OpenAPIAuthenticatedRoute<APIPrincipal> {
return TestOpenAPIOAuthProvider(scopes.asList()).apply(this).apply {
route()
}
} |
have you got it to work ? |
I haven't looked at it well; I'm planning to do it. However, at the first glance, it's easier for me to write my own auth server... |
The OAuth2 spec is a real mess, the configuration you need here is simply to set up the persistence and login validation. Most of the work is done, the only thing missing is a reusable and modular login tunnel system, which is not part of the OAuth2 spec. I can provide you with an example on how to make a proper login tunnel, but the use-case is not fully fleshed out due to intricacies with cross domain access, iframes, and multiple authentication possibilities (ie password and other oauth login providers to choose from). The idea is to make the library evolve to make it simpler to use, it is not refined yet. I used to use the Ktor OAuth authentication, but that is meant to allow you to get data from a service like github or google, not a resource server authorisation to provide content yourself and it slowed the service by a lot (300ms instead of 5ms). |
Thank you, I'm not sure now that I want the same thing. I want just a simple server to generate access and refresh tokens. So maybe it won't be OAuth2-compliant...
I think I'll write my own server using this time, sorry. |
Alright, JWT is usually the easiest way to handle the state of the session because you don't need an underlying persistence layer, and a lot of libraries already exist. You can then require the token in the API requests and use the default ktor authentication system for that, it even is supported by swagger UI. |
It seems that the info in #8 (comment) is irrelevant: classes and functions are missing...
I want to make my own OAuth service to be used by the main service to verify requests.
The text was updated successfully, but these errors were encountered: