oauth2/client/client.go

33 lines
773 B
Go

package client
import (
"somehole.com/common/security/signature"
"somehole.com/service/oauth2/session"
)
type Client struct {
*IdentityProvider
*signature.Keypair
ClientId string
ClientSecret string
RedirectUri string
ResponseType string
Scopes []string
sessions map[session.SessionId]*session.Session
}
func NewClient(idp *IdentityProvider, signer *signature.Keypair, id string, secret string, redirectUri string, responseType string, scopes []string) *Client {
if signer == nil {
signer, _ = signature.NewKeypair()
}
return &Client{
IdentityProvider: idp,
Keypair: signer,
ClientId: id,
ClientSecret: secret,
RedirectUri: redirectUri,
ResponseType: responseType,
Scopes: scopes,
}
}