Closed IamTaoChen closed 1 week ago
I try to test manually, it works with Keycloak. Next, I'll try to add to the frontend and test.
frontend basic example: https://github.com/karlomikus/vue-salt-rim/pull/250
Hi, I appreciate the effort you've put into it. However, after reviewing the changes, I believe this code does not meet the standards I maintain in this project.
Some quick observations: missing unit tests, missing integration tests (which are crucial for the type of functionality this code introduces), not conforming to code style, breaking single responsibility pattern in controller, etc.
Also, since this is Laravel project, I would look into integration existing ecosystem packages like https://github.com/laravel/passport
I appreciate that you've tested the code, but merging it in its current state would introduce significant maintenance challenges in the future.
You can try to resolve the issues mentioned above and resubmit if you'd like. Thanks!
Description
This PR introduces three new endpoints to support OIDC (OpenID Connect) authentication:
/auth/oidc
/auth/oidc/callback
/auth/oidc/token
Flow
The user initiates the OIDC login by sending a POST request to
/auth/oidc
. This request accepts two optional parameters:redirect_url
: If provided, the user will be redirected to this URL upon successful authentication.token_name
: Used to store the token with a custom name if authentication is successful.The response includes {
auth_url
,code
}, where:auth_url
is the URL to complete login with the Identity Provider (IdP).code
is a unique identifier used in the next step to exchange for a token.Redirect to IdP for Authentication: The user is redirected to the
auth_url
provided in the first step, where they complete the login process at the IdP. Upon successful authentication, the IdP redirects the user back to/auth/oidc/callback
.Token Exchange: The user then uses the
code
received in the initial step to exchange it for an authentication token by sending a POST request to/auth/oidc/token
.