33 lines
772 B
Go
33 lines
772 B
Go
|
package client
|
||
|
|
||
|
import (
|
||
|
"somehole.com/common/oauth2/session"
|
||
|
"somehole.com/common/security/signature"
|
||
|
)
|
||
|
|
||
|
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,
|
||
|
}
|
||
|
}
|