William Petit
e66938f1d3
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
33 lines
466 B
Go
33 lines
466 B
Go
package jwt
|
|
|
|
import "forge.cadoles.com/cadoles/bouncer/internal/auth"
|
|
|
|
type Role string
|
|
|
|
const (
|
|
RoleWriter Role = "writer"
|
|
RoleReader Role = "reader"
|
|
)
|
|
|
|
func isValidRole(r string) bool {
|
|
rr := Role(r)
|
|
|
|
return rr == RoleWriter || rr == RoleReader
|
|
}
|
|
|
|
type User struct {
|
|
subject string
|
|
role Role
|
|
}
|
|
|
|
// Subject implements auth.User
|
|
func (u *User) Subject() string {
|
|
return u.subject
|
|
}
|
|
|
|
func (u *User) Role() Role {
|
|
return u.role
|
|
}
|
|
|
|
var _ auth.User = &User{}
|