40 lines
902 B
Go
40 lines
902 B
Go
package provider
|
|
|
|
import (
|
|
"crypto/sha256"
|
|
"time"
|
|
|
|
"github.com/zitadel/oidc/v3/pkg/op"
|
|
"golang.org/x/text/language"
|
|
)
|
|
|
|
type Provider struct {
|
|
config *op.Config
|
|
}
|
|
|
|
func NewProvider() *Provider {
|
|
|
|
config := &op.Config{
|
|
CryptoKey: sha256.Sum256([]byte("syz")),
|
|
DefaultLogoutRedirectURI: "/logged-out",
|
|
CodeMethodS256: true,
|
|
AuthMethodPost: true,
|
|
AuthMethodPrivateKeyJWT: true,
|
|
GrantTypeRefreshToken: true,
|
|
RequestObjectSupported: true,
|
|
SupportedUILocales: []language.Tag{language.Chinese},
|
|
SupportedClaims: op.DefaultSupportedClaims,
|
|
SupportedScopes: op.DefaultSupportedScopes,
|
|
DeviceAuthorization: op.DeviceAuthorizationConfig{
|
|
Lifetime: 5 * time.Minute,
|
|
PollInterval: 5 * time.Second,
|
|
UserFormPath: "/device",
|
|
UserCode: op.UserCodeBase20,
|
|
},
|
|
}
|
|
|
|
return &Provider{
|
|
config: config,
|
|
}
|
|
}
|