Documentation
¶
Index ¶
- Variables
- type APIKeyPrincipal
- type AuthService
- func (s *AuthService) IssueJWT(ctx context.Context, adminID int64, email string, ttl time.Duration) (string, error)
- func (s *AuthService) ValidateAPIKey(ctx context.Context, rawKey string) (*APIKeyPrincipal, error)
- func (s *AuthService) ValidateJWT(ctx context.Context, tokenStr string) (*JWTPrincipal, error)
- type JWTPrincipal
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type APIKeyPrincipal ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService(store *config.Store, jwtSecret string) *AuthService
func (*AuthService) IssueJWT ¶
func (s *AuthService) IssueJWT(ctx context.Context, adminID int64, email string, ttl time.Duration) (string, error)
IssueJWT creates a new signed JWT token for the given admin.
func (*AuthService) ValidateAPIKey ¶
func (s *AuthService) ValidateAPIKey(ctx context.Context, rawKey string) (*APIKeyPrincipal, error)
ValidateAPIKey checks the provided raw API key against stored key hashes.
func (*AuthService) ValidateJWT ¶
func (s *AuthService) ValidateJWT(ctx context.Context, tokenStr string) (*JWTPrincipal, error)
ValidateJWT verifies a JWT bearer token and returns the associated admin identity.
type JWTPrincipal ¶
Click to show internal directories.
Click to hide internal directories.