mirror of
https://github.com/zitadel/zitadel.git
synced 2025-10-24 07:19:28 +00:00
feat: add some api packages
This commit is contained in:
20
internal/api/auth/token.go
Normal file
20
internal/api/auth/token.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
BearerPrefix = "Bearer "
|
||||
)
|
||||
|
||||
func verifyAccessToken(ctx context.Context, token string, t TokenVerifier) (string, string, string, error) {
|
||||
parts := strings.Split(token, BearerPrefix)
|
||||
if len(parts) != 2 {
|
||||
return "", "", "", errors.ThrowUnauthenticated(nil, "AUTH-7fs1e", "invalid auth header")
|
||||
}
|
||||
return t.VerifyAccessToken(ctx, parts[1])
|
||||
}
|
||||
Reference in New Issue
Block a user