Documentation ¶
Overview ¶
*
- Package oidc_server is a modified version of the example server at https://github.com/zitadel/oidc/tree/main/example/server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config[T storage.User] struct { // const ( // // CustomScope is an example for how to use custom scopes in this library // // (in this scenario, when requested, it will return a custom claim) // CustomScope = "custom_scope" // AuthScope = "auth" // // CustomClaim is an example for how to return custom claims with this library // CustomClaim = "custom_claim" // AuthClaim = "auth" // ) // // // customClaim demonstrates how to return custom claims based on provided information // func customClaim(clientID string) map[string]interface{} { // return map[string]interface{}{ // "client": clientID, // "other": "stuff", // } // } // // func SetUserInfoFunc(user *CustomUser, userInfo *oidc.UserInfo, scope string, clientID string) { // switch scope { // case oidc.ScopeOpenID: // userInfo.Subject = user.ID // case oidc.ScopeEmail: // userInfo.Email = user.Email // userInfo.EmailVerified = oidc.Bool(user.EmailVerified) // case oidc.ScopeProfile: // userInfo.PreferredUsername = user.Username // userInfo.Name = user.FirstName + " " + user.LastName // userInfo.FamilyName = user.LastName // userInfo.GivenName = user.FirstName // userInfo.Locale = oidc.NewLocale(user.PreferredLanguage) // case oidc.ScopePhone: // userInfo.PhoneNumber = user.Phone // userInfo.PhoneNumberVerified = user.PhoneVerified // case AuthScope: // userInfo.AppendClaims(AuthClaim, map[string]interface{}{ // "is_admin": user.IsAdmin, // }) // case CustomScope: // userInfo.AppendClaims(CustomClaim, customClaim(clientID)) // } // } SetUserInfoFunc storage.SetUserInfoFunc[T] // GetPrivateClaimsFromScopesFunc will be called for the creation of a JWT access token to assert claims for custom scopes. // Example: // func getPrivateClaimsFromScopes(ctx context.Context, userID, clientID string, scopes []string) (claims map[string]interface{}, err error) { // for _, scope := range scopes { // switch scope { // case CustomScope: // claims = storage.AppendClaim(claims, CustomClaim, customClaim(clientID)) // } // } // return claims, nil // } GetPrivateClaimsFromScopesFunc storage.GetPrivateClaimsFromScopesFunc // TLS runs the server with the given certificate. TLS *struct { CertFile string KeyFile string } // PathPrefix represents domain subdirectories for the base URL, if any. PathPrefix string }
Config defines OIDC server configuration.
Click to show internal directories.
Click to hide internal directories.