oauth2/client/client.go

33 lines
773 B
Go
Raw Normal View History

2024-10-01 17:38:43 +00:00
package client
import (
"somehole.com/common/security/signature"
2024-10-09 00:33:23 +00:00
"somehole.com/service/oauth2/session"
2024-10-01 17:38:43 +00:00
)
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,
}
}