You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
525 B
Go
36 lines
525 B
Go
package authsession
|
|
|
|
type claim struct {
|
|
Name string
|
|
Value string
|
|
}
|
|
|
|
type Claims []claim
|
|
|
|
func (c *Claims) Add(name string, value string) {
|
|
*c = append(*c, claim{
|
|
Name: name,
|
|
Value: value,
|
|
})
|
|
}
|
|
|
|
func (c *Claims) Contains(claim string) bool {
|
|
for _, curr := range *c {
|
|
if curr.Name == claim {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (c *Claims) Has(claim string, value string) bool {
|
|
for _, curr := range *c {
|
|
if curr.Name == claim {
|
|
if curr.Value == value {
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
return false
|
|
}
|