github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/boom/api/latest/reconciling/auth/oidc/oidc.go (about)

     1  package oidc
     2  
     3  import (
     4  	secret2 "github.com/caos/orbos/pkg/secret"
     5  )
     6  
     7  type OIDC struct {
     8  	//Internal name of the OIDC provider
     9  	Name string `json:"name,omitempty" yaml:"name,omitempty"`
    10  	//Issuer of the OIDC provider
    11  	Issuer   string          `json:"issuer,omitempty" yaml:"issuer,omitempty"`
    12  	ClientID *secret2.Secret `json:"clientID,omitempty" yaml:"clientID,omitempty"`
    13  	//Existing secret with the clientID
    14  	ExistingClientIDSecret *secret2.Existing `json:"existingClientIDSecret,omitempty" yaml:"existingClientIDSecret,omitempty"`
    15  	ClientSecret           *secret2.Secret   `json:"clientSecret,omitempty" yaml:"clientSecret,omitempty"`
    16  	//Existing secret with the clientSecret
    17  	ExistingClientSecretSecret *secret2.Existing `json:"existingClientSecretSecret,omitempty" yaml:"existingClientSecretSecret,omitempty"`
    18  	//Optional set of OIDC scopes to request. If omitted, defaults to: ["openid", "profile", "email", "groups"]
    19  	RequestedScopes []string `json:"requestedScopes,omitempty" yaml:"requestedScopes,omitempty"`
    20  	//Optional set of OIDC claims to request on the ID token.
    21  	RequestedIDTokenClaims map[string]Claim `json:"requestedIDTokenClaims,omitempty" yaml:"requestedIDTokenClaims,omitempty"`
    22  }
    23  
    24  func (c *OIDC) IsZero() bool {
    25  	if (c.ClientID == nil || c.ClientID.IsZero()) &&
    26  		(c.ClientSecret == nil || c.ClientSecret.IsZero()) &&
    27  		c.ExistingClientIDSecret == nil &&
    28  		c.ExistingClientSecretSecret == nil &&
    29  		c.Name == "" &&
    30  		c.Issuer == "" &&
    31  		c.RequestedScopes == nil &&
    32  		c.RequestedIDTokenClaims == nil {
    33  		return true
    34  	}
    35  	return false
    36  }
    37  
    38  type Claim struct {
    39  	//Define if the claim is required, otherwise the login will fail
    40  	Essential bool `json:"essential,omitempty" yaml:"essential,omitempty"`
    41  	//Required values of the claim, otherwise hte login will fail
    42  	Values []string `json:"values,omitempty" yaml:"values,omitempty"`
    43  }