33 lines
644 B
Go
33 lines
644 B
Go
package auth
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/coreos/go-oidc/v3/oidc"
|
|
"golang.org/x/oauth2"
|
|
)
|
|
|
|
var OAuthConfigs []oauth2.Config
|
|
|
|
func CreateTestOAuth() {
|
|
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",
|
|
RedirectURL: "http://localhost:8080/callback",
|
|
Endpoint: provider.Endpoint(),
|
|
Scopes: []string{
|
|
oidc.ScopeOpenID,
|
|
"profile",
|
|
"email",
|
|
},
|
|
}
|
|
OAuthConfigs = append(OAuthConfigs, oauthConfig)
|
|
tokenStore = TokenStore{filePath: "token.json"}
|
|
}
|