Files
nomad/lib/auth/oidc/identity.go
James Rasell 872bb4f2fe lib: add OIDC provider cache and callback server.
The OIDC provider cache is used by the RPC handler as the OIDC
implementation keeps long lived processes running. These process
include connections to the remote OIDC provider.

The Callback server is used by the CLI and starts when the login
command is triggered. This callback server includes success HTML
which is displayed when the user successfully logs into the remote
OIDC provider.
2023-01-13 13:14:50 +00:00

37 lines
941 B
Go

package oidc
import (
"github.com/hashicorp/nomad/nomad/structs"
)
type Identity struct {
// Claims is the format of this Identity suitable for selection
// with a binding rule.
Claims interface{}
// ClaimMappings is the format of this Identity suitable for interpolation in a
// bind name within a binding rule.
ClaimMappings map[string]string
}
// NewIdentity builds a new Identity that can be used to generate bindings via
// Bind for ACL token creation.
func NewIdentity(
authMethodConfig *structs.ACLAuthMethodConfig, authClaims *structs.ACLAuthClaims) *Identity {
claimMappings := make(map[string]string)
// Populate claimMappings vars with empty values so HIL works.
for _, k := range authMethodConfig.ClaimMappings {
claimMappings["value."+k] = ""
}
for k, val := range authClaims.Value {
claimMappings["value."+k] = val
}
return &Identity{
Claims: authClaims,
ClaimMappings: claimMappings,
}
}