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
feat: Imprement jwt-auth header auth method #2961
base: master
Are you sure you want to change the base?
Conversation
Continued from filebrowser#2474 Co-authored-by: Travis Johnson <travis@thisguy.codes>
a.init.Do(func() { | ||
a.remoteKeySet = oidc.NewRemoteKeySet(context.Background(), a.CertsURL) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to do it in the constructor func
func NewJWTAuth(...){
...
}
// The Application Audience (AUD) tag for your application | ||
config := &oidc.Config{ | ||
ClientID: a.Aud, | ||
} | ||
|
||
verifier := oidc.NewVerifier(a.Iss, a.remoteKeySet, config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good candidate to be moved into the constructor
|
||
accessJWT := r.Header.Get(a.Header) | ||
if accessJWT == "" { | ||
return nil, os.ErrPermission |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to log an error here
|
||
token, err := verifier.Verify(r.Context(), accessJWT) | ||
if err != nil { | ||
return nil, os.ErrPermission |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please log the original error
payload := map[string]any{} | ||
err = token.Claims(&payload) | ||
if err != nil { | ||
return nil, os.ErrPermission |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please log the original error
|
||
user, err := usr.Get(srv.Root, payload[a.UsernameClaim]) | ||
if nerrors.Is(err, errors.ErrNotExist) { | ||
return nil, os.ErrPermission |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please log the original error
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Description
This change is based on #2474. See original PR for detailed description.
To configure the filebrowser for Cloudflare Zero Trust, run the following command:
🚨 Before submitting your PR, please read community, and indicate which issues (in any of the repos) are either fixed or closed by this PR. See GitHub Help: Closing issues using keywords.
Further comments