diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-02 14:29:41 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-02 14:29:41 -0600 |
| commit | c583bcd1473205104a1e1af812ed4976d30c7baa (patch) | |
| tree | 933edf78a4ac8aea55256e42641e56bbb4c58834 /pkg/authz/token.go | |
| parent | 91defaefca47e9cebbe92c6abf33c4423df9bc7d (diff) | |
refactor: remove anything unrelated to the authz daemon
Diffstat (limited to 'pkg/authz/token.go')
| -rw-r--r-- | pkg/authz/token.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/pkg/authz/token.go b/pkg/authz/token.go deleted file mode 100644 index 2794bf4a..00000000 --- a/pkg/authz/token.go +++ /dev/null @@ -1,30 +0,0 @@ -package authz - -import ( - "net/http" - "strings" - - "github.com/lestrrat-go/jwx/v3/jwt" - "github.com/xlgmokha/x/pkg/log" -) - -func TokenFrom(r *http.Request) jwt.Token { - authorization := r.Header.Get("Authorization") - if authorization == "" || !strings.Contains(authorization, "Bearer") { - return jwt.New() - } - - token, err := jwt.ParseRequest(r, - jwt.WithContext(r.Context()), - jwt.WithHeaderKey("Authorization"), - jwt.WithValidate(false), // TODO:: Connect this to a JSON Web Key Set - jwt.WithVerify(false), // TODO:: Connect this to a JSON Web Key Set - ) - - if err != nil { - log.WithFields(r.Context(), log.Fields{"error": err}) - return jwt.New() - } - - return token -} |
