This commit is contained in:
Livio Amstutz 2019-11-28 08:01:31 +01:00
parent d1d04295a6
commit 8ee38d2ec8
14 changed files with 469 additions and 85 deletions

View file

@ -78,18 +78,13 @@ func (a *AccessTokenRequest) GrantType() GrantType {
}
type AccessTokenResponse struct {
AccessToken string `json:"access_token,omitempty"`
TokenType string `json:"token_type,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
ExpiresIn uint64 `json:"expires_in,omitempty"`
IDToken string `json:"id_token,omitempty"`
AccessToken string `json:"access_token,omitempty" schema:"access_token,omitempty"`
TokenType string `json:"token_type,omitempty" schema:"token_type,omitempty"`
RefreshToken string `json:"refresh_token,omitempty" schema:"refresh_token,omitempty"`
ExpiresIn uint64 `json:"expires_in,omitempty" schema:"expires_in,omitempty"`
IDToken string `json:"id_token,omitempty" schema:"id_token,omitempty"`
}
// func (a AccessTokenRequest) UnmarshalText(text []byte) error {
// fmt.Println(string(text))
// return nil
// }
type TokenExchangeRequest struct {
subjectToken string `schema:"subject_token"`
subjectTokenType string `schema:"subject_token_type"`

View file

@ -2,17 +2,29 @@ package oidc
type Client interface {
RedirectURIs() []string
Type() ClientType
ApplicationType() ApplicationType
LoginURL(string) string
}
type ClientType int
// type ClientType int
func (c ClientType) IsConvidential() bool {
return c == ClientTypeConfidential
// func (c ClientType) IsConvidential() bool {
// return c == ClientTypeConfidential
// }
func IsConfidentialType(c Client) bool {
return c.ApplicationType() == ApplicationTypeWeb
}
type ApplicationType int
// const (a ApplicationType)
const (
ClientTypeConfidential ClientType = iota
ClientTypePublic
// ClientTypeConfidential ClientType = iota
// ClientTypePublic
ApplicationTypeWeb ApplicationType = iota
ApplicationTypeUserAgent
ApplicationTypeNative
)