This commit is contained in:
Livio Amstutz 2021-10-25 12:07:08 +02:00
parent 052a86f28a
commit 3b89a976b3
3 changed files with 92 additions and 92 deletions

View file

@ -8,12 +8,12 @@ import (
"strings" "strings"
"time" "time"
httphelper "github.com/caos/oidc/pkg/http"
"github.com/google/uuid" "github.com/google/uuid"
"golang.org/x/oauth2" "golang.org/x/oauth2"
"gopkg.in/square/go-jose.v2" "gopkg.in/square/go-jose.v2"
"github.com/caos/oidc/pkg/client" "github.com/caos/oidc/pkg/client"
httphelper "github.com/caos/oidc/pkg/http"
"github.com/caos/oidc/pkg/oidc" "github.com/caos/oidc/pkg/oidc"
) )

View file

@ -42,181 +42,181 @@ type introspectionResponse struct {
claims map[string]interface{} claims map[string]interface{}
} }
func (u *introspectionResponse) IsActive() bool { func (i *introspectionResponse) IsActive() bool {
return u.Active return i.Active
} }
func (u *introspectionResponse) SetScopes(scope []string) { func (i *introspectionResponse) SetScopes(scope []string) {
u.Scope = scope i.Scope = scope
} }
func (u *introspectionResponse) SetClientID(id string) { func (i *introspectionResponse) SetClientID(id string) {
u.ClientID = id i.ClientID = id
} }
func (u *introspectionResponse) GetSubject() string { func (i *introspectionResponse) GetSubject() string {
return u.Subject return i.Subject
} }
func (u *introspectionResponse) GetName() string { func (i *introspectionResponse) GetName() string {
return u.Name return i.Name
} }
func (u *introspectionResponse) GetGivenName() string { func (i *introspectionResponse) GetGivenName() string {
return u.GivenName return i.GivenName
} }
func (u *introspectionResponse) GetFamilyName() string { func (i *introspectionResponse) GetFamilyName() string {
return u.FamilyName return i.FamilyName
} }
func (u *introspectionResponse) GetMiddleName() string { func (i *introspectionResponse) GetMiddleName() string {
return u.MiddleName return i.MiddleName
} }
func (u *introspectionResponse) GetNickname() string { func (i *introspectionResponse) GetNickname() string {
return u.Nickname return i.Nickname
} }
func (u *introspectionResponse) GetProfile() string { func (i *introspectionResponse) GetProfile() string {
return u.Profile return i.Profile
} }
func (u *introspectionResponse) GetPicture() string { func (i *introspectionResponse) GetPicture() string {
return u.Picture return i.Picture
} }
func (u *introspectionResponse) GetWebsite() string { func (i *introspectionResponse) GetWebsite() string {
return u.Website return i.Website
} }
func (u *introspectionResponse) GetGender() Gender { func (i *introspectionResponse) GetGender() Gender {
return u.Gender return i.Gender
} }
func (u *introspectionResponse) GetBirthdate() string { func (i *introspectionResponse) GetBirthdate() string {
return u.Birthdate return i.Birthdate
} }
func (u *introspectionResponse) GetZoneinfo() string { func (i *introspectionResponse) GetZoneinfo() string {
return u.Zoneinfo return i.Zoneinfo
} }
func (u *introspectionResponse) GetLocale() language.Tag { func (i *introspectionResponse) GetLocale() language.Tag {
return u.Locale return i.Locale
} }
func (u *introspectionResponse) GetPreferredUsername() string { func (i *introspectionResponse) GetPreferredUsername() string {
return u.PreferredUsername return i.PreferredUsername
} }
func (u *introspectionResponse) GetEmail() string { func (i *introspectionResponse) GetEmail() string {
return u.Email return i.Email
} }
func (u *introspectionResponse) IsEmailVerified() bool { func (i *introspectionResponse) IsEmailVerified() bool {
return u.EmailVerified return i.EmailVerified
} }
func (u *introspectionResponse) GetPhoneNumber() string { func (i *introspectionResponse) GetPhoneNumber() string {
return u.PhoneNumber return i.PhoneNumber
} }
func (u *introspectionResponse) IsPhoneNumberVerified() bool { func (i *introspectionResponse) IsPhoneNumberVerified() bool {
return u.PhoneNumberVerified return i.PhoneNumberVerified
} }
func (u *introspectionResponse) GetAddress() UserInfoAddress { func (i *introspectionResponse) GetAddress() UserInfoAddress {
return u.Address return i.Address
} }
func (u *introspectionResponse) GetClaim(key string) interface{} { func (i *introspectionResponse) GetClaim(key string) interface{} {
return u.claims[key] return i.claims[key]
} }
func (u *introspectionResponse) SetActive(active bool) { func (i *introspectionResponse) SetActive(active bool) {
u.Active = active i.Active = active
} }
func (u *introspectionResponse) SetSubject(sub string) { func (i *introspectionResponse) SetSubject(sub string) {
u.Subject = sub i.Subject = sub
} }
func (u *introspectionResponse) SetName(name string) { func (i *introspectionResponse) SetName(name string) {
u.Name = name i.Name = name
} }
func (u *introspectionResponse) SetGivenName(name string) { func (i *introspectionResponse) SetGivenName(name string) {
u.GivenName = name i.GivenName = name
} }
func (u *introspectionResponse) SetFamilyName(name string) { func (i *introspectionResponse) SetFamilyName(name string) {
u.FamilyName = name i.FamilyName = name
} }
func (u *introspectionResponse) SetMiddleName(name string) { func (i *introspectionResponse) SetMiddleName(name string) {
u.MiddleName = name i.MiddleName = name
} }
func (u *introspectionResponse) SetNickname(name string) { func (i *introspectionResponse) SetNickname(name string) {
u.Nickname = name i.Nickname = name
} }
func (u *introspectionResponse) SetUpdatedAt(date time.Time) { func (i *introspectionResponse) SetUpdatedAt(date time.Time) {
u.UpdatedAt = Time(date) i.UpdatedAt = Time(date)
} }
func (u *introspectionResponse) SetProfile(profile string) { func (i *introspectionResponse) SetProfile(profile string) {
u.Profile = profile i.Profile = profile
} }
func (u *introspectionResponse) SetPicture(picture string) { func (i *introspectionResponse) SetPicture(picture string) {
u.Picture = picture i.Picture = picture
} }
func (u *introspectionResponse) SetWebsite(website string) { func (i *introspectionResponse) SetWebsite(website string) {
u.Website = website i.Website = website
} }
func (u *introspectionResponse) SetGender(gender Gender) { func (i *introspectionResponse) SetGender(gender Gender) {
u.Gender = gender i.Gender = gender
} }
func (u *introspectionResponse) SetBirthdate(birthdate string) { func (i *introspectionResponse) SetBirthdate(birthdate string) {
u.Birthdate = birthdate i.Birthdate = birthdate
} }
func (u *introspectionResponse) SetZoneinfo(zoneInfo string) { func (i *introspectionResponse) SetZoneinfo(zoneInfo string) {
u.Zoneinfo = zoneInfo i.Zoneinfo = zoneInfo
} }
func (u *introspectionResponse) SetLocale(locale language.Tag) { func (i *introspectionResponse) SetLocale(locale language.Tag) {
u.Locale = locale i.Locale = locale
} }
func (u *introspectionResponse) SetPreferredUsername(name string) { func (i *introspectionResponse) SetPreferredUsername(name string) {
u.PreferredUsername = name i.PreferredUsername = name
} }
func (u *introspectionResponse) SetEmail(email string, verified bool) { func (i *introspectionResponse) SetEmail(email string, verified bool) {
u.Email = email i.Email = email
u.EmailVerified = verified i.EmailVerified = verified
} }
func (u *introspectionResponse) SetPhone(phone string, verified bool) { func (i *introspectionResponse) SetPhone(phone string, verified bool) {
u.PhoneNumber = phone i.PhoneNumber = phone
u.PhoneNumberVerified = verified i.PhoneNumberVerified = verified
} }
func (u *introspectionResponse) SetAddress(address UserInfoAddress) { func (i *introspectionResponse) SetAddress(address UserInfoAddress) {
u.Address = address i.Address = address
} }
func (u *introspectionResponse) AppendClaims(key string, value interface{}) { func (i *introspectionResponse) AppendClaims(key string, value interface{}) {
if u.claims == nil { if i.claims == nil {
u.claims = make(map[string]interface{}) i.claims = make(map[string]interface{})
} }
u.claims[key] = value i.claims[key] = value
} }
func (i *introspectionResponse) MarshalJSON() ([]byte, error) { func (i *introspectionResponse) MarshalJSON() ([]byte, error) {

View file

@ -12,7 +12,7 @@ const (
//GrantTypeCode defines the grant_type `authorization_code` used for the Token Request in the Authorization Code Flow //GrantTypeCode defines the grant_type `authorization_code` used for the Token Request in the Authorization Code Flow
GrantTypeCode GrantType = "authorization_code" GrantTypeCode GrantType = "authorization_code"
//GrantTypeCode defines the grant_type `refresh_token` used for the Token Request in the Refresh Token Flow //GrantTypeRefreshToken defines the grant_type `refresh_token` used for the Token Request in the Refresh Token Flow
GrantTypeRefreshToken GrantType = "refresh_token" GrantTypeRefreshToken GrantType = "refresh_token"
//GrantTypeBearer defines the grant_type `urn:ietf:params:oauth:grant-type:jwt-bearer` used for the JWT Authorization Grant //GrantTypeBearer defines the grant_type `urn:ietf:params:oauth:grant-type:jwt-bearer` used for the JWT Authorization Grant