-
Notifications
You must be signed in to change notification settings - Fork 4
/
claims.go
30 lines (26 loc) · 1.18 KB
/
claims.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package atlas_claims
import (
"github.com/golang-jwt/jwt/v4"
)
// Subject describes the authenticated entity making a request.
type Subject struct {
Id string `json:"id,omitempty"` // user_email if authentication_type=(user_jwt|api_key)
SubjectType string `json:"subject_type"` //valid values: user/s2s
AuthenticationId string `json:"authentication_id,omitempty"` // the id of the api_key if authentication_type=token
AuthenticationType string `json:"authentication_type"` //valid values: bearer/token
}
// Claims models the claims that atlas authz cares about.
type Claims struct {
UserId string `json:"user_id,omitempty"`
IdentityUserId string `json:"identity_user_id,omitempty"`
AccountId string `json:"account_id,omitempty"`
IdentityAccountId string `json:"identity_account_id,omitempty"`
Service string `json:"service,omitempty"`
Groups []string `json:"groups,omitempty"`
Subject Subject `json:"subject"`
CompartmentID string `json:"compartment_id,omitempty"`
jwt.StandardClaims
}
func (c Claims) Valid() error {
return c.StandardClaims.Valid()
}