actually do some OAuth
This commit is contained in:
+16
-7
@@ -1,22 +1,31 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/coreos/go-oidc/v3/oidc"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
var oauthConfigs []oauth2.Config
|
||||
var OAuthConfigs []oauth2.Config
|
||||
|
||||
func CreateTestOAuth() {
|
||||
oauthEndpoint := oauth2.Endpoint{
|
||||
AuthURL: "https://account.astraltech.xyz/application/o/authorize/",
|
||||
TokenURL: "https://account.astraltech.xyz/application/o/token/",
|
||||
ctx := context.Background()
|
||||
|
||||
provider, err := oidc.NewProvider(ctx, "https://account.astraltech.xyz/application/o/stalwart/")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
oauthConfig := oauth2.Config{
|
||||
ClientID: "stalwart-webui",
|
||||
Scopes: []string{"openid", "profile", "email"},
|
||||
Endpoint: oauthEndpoint,
|
||||
RedirectURL: "http://localhost:8080/callback",
|
||||
Endpoint: provider.Endpoint(),
|
||||
Scopes: []string{
|
||||
oidc.ScopeOpenID,
|
||||
"profile",
|
||||
"email",
|
||||
},
|
||||
}
|
||||
oauthConfigs = append(oauthConfigs, oauthConfig)
|
||||
OAuthConfigs = append(OAuthConfigs, oauthConfig)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user