Documentation ¶
Overview ¶
Package openid provides a specialized token that provides utilities to work with OpenID JWT tokens.
In order to use OpenID claims, you specify the token to use in the jwt.Parse method
jwt.Parse(data, jwt.WithOpenIDClaims())
This file is auto-generated by jwt/internal/cmd/gentoken/main.go. DO NOT EDIT
Index ¶
- Constants
- type AddressClaim
- func (t *AddressClaim) Accept(v interface{}) error
- func (t AddressClaim) Country() string
- func (t AddressClaim) Formatted() string
- func (t *AddressClaim) Get(s string) (interface{}, bool)
- func (t AddressClaim) Locality() string
- func (t AddressClaim) MarshalJSON() ([]byte, error)
- func (t AddressClaim) PostalCode() string
- func (t AddressClaim) Region() string
- func (t *AddressClaim) Set(key string, value interface{}) error
- func (t AddressClaim) StreetAddress() string
- func (t *AddressClaim) UnmarshalJSON(data []byte) error
- type BirthdateClaim
- func (b *BirthdateClaim) Accept(v interface{}) error
- func (b BirthdateClaim) Day() int
- func (b BirthdateClaim) MarshalText() ([]byte, error)
- func (b BirthdateClaim) Month() int
- func (b BirthdateClaim) String() string
- func (b *BirthdateClaim) UnmarshalJSON(data []byte) error
- func (b BirthdateClaim) Year() int
- type ClaimPair
- type Iterator
- type Token
- type Visitor
- type VisitorFunc
Constants ¶
const ( AddressFormattedKey = "formatted" AddressStreetAddressKey = "street_address" AddressLocalityKey = "locality" AddressRegionKey = "region" AddressPostalCodeKey = "postal_code" AddressCountryKey = "country" )
const ( AudienceKey = "aud" ExpirationKey = "exp" IssuedAtKey = "iat" IssuerKey = "iss" JwtIDKey = "jti" NotBeforeKey = "nbf" SubjectKey = "sub" NameKey = "name" GivenNameKey = "given_name" MiddleNameKey = "middle_name" FamilyNameKey = "family_name" NicknameKey = "nickname" PreferredUsernameKey = "preferred_username" ProfileKey = "profile" PictureKey = "picture" WebsiteKey = "website" EmailKey = "email" EmailVerifiedKey = "email_verified" GenderKey = "gender" BirthdateKey = "birthdate" ZoneinfoKey = "zoneinfo" LocaleKey = "locale" PhoneNumberKey = "phone_number" PhoneNumberVerifiedKey = "phone_number_verified" AddressKey = "address" UpdatedAtKey = "updated_at" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressClaim ¶
type AddressClaim struct {
// contains filtered or unexported fields
}
AddressClaim is the address claim as described in https://openid.net/specs/openid-connect-core-1_0.html#AddressClaim
func NewAddress ¶
func NewAddress() *AddressClaim
func (*AddressClaim) Accept ¶
func (t *AddressClaim) Accept(v interface{}) error
func (AddressClaim) Country ¶
func (t AddressClaim) Country() string
Country is a convenience function to retrieve the corresponding value store in the token if there is a problem retrieving the value, the zero value is returned. If you need to differentiate between existing/non-existing values, use `Get` instead
func (AddressClaim) Formatted ¶
func (t AddressClaim) Formatted() string
Formatted is a convenience function to retrieve the corresponding value store in the token if there is a problem retrieving the value, the zero value is returned. If you need to differentiate between existing/non-existing values, use `Get` instead
func (*AddressClaim) Get ¶
func (t *AddressClaim) Get(s string) (interface{}, bool)
func (AddressClaim) Locality ¶
func (t AddressClaim) Locality() string
Locality is a convenience function to retrieve the corresponding value store in the token if there is a problem retrieving the value, the zero value is returned. If you need to differentiate between existing/non-existing values, use `Get` instead
func (AddressClaim) MarshalJSON ¶
func (t AddressClaim) MarshalJSON() ([]byte, error)
MarshalJSON serializes the token in JSON format.
func (AddressClaim) PostalCode ¶
func (t AddressClaim) PostalCode() string
PostalCode is a convenience function to retrieve the corresponding value store in the token if there is a problem retrieving the value, the zero value is returned. If you need to differentiate between existing/non-existing values, use `Get` instead
func (AddressClaim) Region ¶
func (t AddressClaim) Region() string
Region is a convenience function to retrieve the corresponding value store in the token if there is a problem retrieving the value, the zero value is returned. If you need to differentiate between existing/non-existing values, use `Get` instead
func (*AddressClaim) Set ¶
func (t *AddressClaim) Set(key string, value interface{}) error
func (AddressClaim) StreetAddress ¶
func (t AddressClaim) StreetAddress() string
StreetAddress is a convenience function to retrieve the corresponding value store in the token if there is a problem retrieving the value, the zero value is returned. If you need to differentiate between existing/non-existing values, use `Get` instead
func (*AddressClaim) UnmarshalJSON ¶
func (t *AddressClaim) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes data from a JSON data buffer into a AddressClaim
type BirthdateClaim ¶
type BirthdateClaim struct {
// contains filtered or unexported fields
}
func (*BirthdateClaim) Accept ¶
func (b *BirthdateClaim) Accept(v interface{}) error
Accepts a value read from JSON, and converts it to a BirthdateClaim. This method DOES NOT verify the correctness of a date. Consumers should check for validity of dates such as Apr 31 et al
func (BirthdateClaim) Day ¶
func (b BirthdateClaim) Day() int
func (BirthdateClaim) MarshalText ¶
func (b BirthdateClaim) MarshalText() ([]byte, error)
func (BirthdateClaim) Month ¶
func (b BirthdateClaim) Month() int
func (BirthdateClaim) String ¶
func (b BirthdateClaim) String() string
func (*BirthdateClaim) UnmarshalJSON ¶
func (b *BirthdateClaim) UnmarshalJSON(data []byte) error
func (BirthdateClaim) Year ¶
func (b BirthdateClaim) Year() int
type Token ¶
type Token interface { Audience() []string Expiration() time.Time IssuedAt() time.Time Issuer() string JwtID() string NotBefore() time.Time Subject() string Name() string GivenName() string MiddleName() string FamilyName() string Nickname() string PreferredUsername() string Profile() string Picture() string Website() string Email() string EmailVerified() bool Gender() string Birthdate() *BirthdateClaim Zoneinfo() string Locale() string PhoneNumber() string PhoneNumberVerified() bool Address() *AddressClaim UpdatedAt() time.Time PrivateClaims() map[string]interface{} Get(string) (interface{}, bool) Set(string, interface{}) error Iterate(context.Context) Iterator Walk(context.Context, Visitor) error AsMap(context.Context) (map[string]interface{}, error) }
func New ¶
func New() Token
New creates a standard token, with minimal knowledge of possible claims. Standard claims include"aud", "exp", "iat", "iss", "jti", "nbf", "sub", "name", "given_name", "middle_name", "family_name", "nickname", "preferred_username", "profile", "picture", "website", "email", "email_verified", "gender", "birthdate", "zoneinfo", "locale", "phone_number", "phone_number_verified", "address" and "updated_at". Convenience accessors are provided for these standard claims
type Visitor ¶
type Visitor = iter.MapVisitor
type VisitorFunc ¶
type VisitorFunc = iter.MapVisitorFunc