-
Notifications
You must be signed in to change notification settings - Fork 3
Add JWT-based auth to serve command #79
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ba0e37d
reduce GOAMD64 to v2 (see #78)
chocolatkey 1a68d2f
require TLSv1.2 or greater in the HTTP client
chocolatkey d1802d9
implement authentication for serve command
chocolatkey 6b3eb36
remove demo list endpoint
chocolatkey 73ba3ad
Update serve command description
chocolatkey ee2f89c
update changelog
chocolatkey b7d3428
increase WriteTimeout for serve command's webserver
chocolatkey 49f3526
add `/webpub` prefix to publication server, redirect from path to man…
chocolatkey 9cad76f
update changelog
chocolatkey 815fe22
move version logic to its own internal package
chocolatkey a2e067e
adjustments
chocolatkey 43d5267
switch to switch
chocolatkey 3013e5c
update changelog
chocolatkey 4a9a99f
Update internal/cli/serve.go
chocolatkey 51aba6b
use http status constants
chocolatkey dea0fc4
Merge branch 'develop' into jwt-auth
chocolatkey bfab343
fix mod
chocolatkey 61182c2
Merge branch 'develop' into jwt-auth
chocolatkey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ builds: | |
| goarm: | ||
| - '7' | ||
| goamd64: | ||
| - v3 | ||
| - v2 | ||
| ldflags: | ||
| - -s -w | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package cli | ||
| package version | ||
|
|
||
| import ( | ||
| "runtime/debug" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package auth | ||
|
|
||
| type AuthProvider interface { | ||
| Validate(token string) (string, int, error) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package auth | ||
|
|
||
| import ( | ||
| "encoding/base64" | ||
| "fmt" | ||
| "net/http" | ||
| ) | ||
|
|
||
| type B64EncodedAuthProvider struct{} | ||
|
|
||
| func (n *B64EncodedAuthProvider) Validate(token string) (string, int, error) { | ||
| path, err := base64.RawURLEncoding.DecodeString(token) | ||
| if err != nil { | ||
| return "", http.StatusBadRequest, fmt.Errorf("invalid base64url path: %w", err) | ||
| } | ||
| return string(path), http.StatusOK, nil | ||
| } | ||
|
|
||
| func NewB64EncodedAuthProvider() *B64EncodedAuthProvider { | ||
| return &B64EncodedAuthProvider{} | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
[nitpick] The flag description is very long and may be difficult to read in CLI help output. Consider breaking it into shorter text or moving detailed explanations to the Long description.