github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/boom/api/v1beta1/grafana/auth/Generic/generic.go (about)

     1  package generic
     2  
     3  import (
     4  	secret2 "github.com/caos/orbos/pkg/secret"
     5  )
     6  
     7  type Auth struct {
     8  	ClientID *secret2.Secret `json:"clientID,omitempty" yaml:"clientID,omitempty"`
     9  	//Existing secret with the clientID
    10  	ExistingClientIDSecret *secret2.Existing `json:"existingClientIDSecret,omitempty" yaml:"existingClientIDSecret,omitempty"`
    11  	ClientSecret           *secret2.Secret   `json:"clientSecret,omitempty" yaml:"clientSecret,omitempty"`
    12  	//Existing secret with the clientSecret
    13  	ExistingClientSecretSecret *secret2.Existing `json:"existingClientSecretSecret,omitempty" yaml:"existingClientSecretSecret,omitempty"`
    14  	//Used scopes for the OAuth-flow
    15  	Scopes []string `json:"scopes,omitempty" yaml:"scopes,omitempty"`
    16  	//Auth-endpoint
    17  	AuthURL string `json:"authURL,omitempty" yaml:"authURL,omitempty"`
    18  	//Token-endpoint
    19  	TokenURL string `json:"tokenURL,omitempty" yaml:"tokenURL,omitempty"`
    20  	//Userinfo-endpoint
    21  	APIURL string `json:"apiURL,omitempty" yaml:"apiURL,omitempty"`
    22  	//Domains allowed to login
    23  	AllowedDomains []string `json:"allowedDomains,omitempty" yaml:"allowedDomains,omitempty"`
    24  }
    25  
    26  func (a *Auth) IsZero() bool {
    27  	if (a.ClientID == nil || a.ClientID.IsZero()) &&
    28  		(a.ClientSecret == nil || a.ClientSecret.IsZero()) &&
    29  		a.ExistingClientIDSecret == nil &&
    30  		a.ExistingClientSecretSecret == nil &&
    31  		a.Scopes == nil &&
    32  		a.AuthURL == "" &&
    33  		a.TokenURL == "" &&
    34  		a.APIURL == "" &&
    35  		a.AllowedDomains == nil {
    36  		return true
    37  	}
    38  
    39  	return false
    40  }