interface

This commit is contained in:
Livio Amstutz 2019-11-28 15:29:19 +01:00
parent 80eeee2de2
commit 988a556fa9
10 changed files with 131 additions and 76 deletions

30
pkg/op/u/client.go Normal file
View file

@ -0,0 +1,30 @@
package u
type Client interface {
RedirectURIs() []string
ApplicationType() ApplicationType
LoginURL(string) string
}
// type ClientType int
// 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
ApplicationTypeWeb ApplicationType = iota
ApplicationTypeUserAgent
ApplicationTypeNative
)

View file

@ -3,11 +3,30 @@ package u
import "github.com/caos/oidc/pkg/oidc"
type Storage interface {
CreateAuthRequest(*oidc.AuthRequest) error
GetClientByClientID(string) (oidc.Client, error)
AuthRequestByID(string) (*oidc.AuthRequest, error)
AuthRequestByCode(oidc.Client, string, string) (*oidc.AuthRequest, error)
AuthorizeClientIDSecret(string, string) (oidc.Client, error)
AuthorizeClientIDCodeVerifier(string, string) (oidc.Client, error)
CreateAuthRequest(*oidc.AuthRequest) (AuthRequest, error)
GetClientByClientID(string) (Client, error)
AuthRequestByID(string) (AuthRequest, error)
AuthRequestByCode(Client, string, string) (AuthRequest, error)
AuthorizeClientIDSecret(string, string) (Client, error)
AuthorizeClientIDCodeVerifier(string, string) (Client, error)
DeleteAuthRequestAndCode(string, string) error
}
type ErrAuthRequest interface {
GetRedirectURI() string
GetResponseType() oidc.ResponseType
GetState() string
}
type AuthRequest interface {
GetID() string
GetACR() string
GetAMR() []string
GetAudience() []string
GetClientID() string
GetNonce() string
GetRedirectURI() string
GetResponseType() oidc.ResponseType
GetState() string
GetSubject() string
}