oidc.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package integrations
  2. import "gorm.io/gorm"
  3. // OIDCIntegrationClient is the name of an OIDC auth mechanism client
  4. type OIDCIntegrationClient string
  5. // The supported OIDC auth mechanism clients
  6. const (
  7. OIDCKube OIDCIntegrationClient = "kube"
  8. )
  9. // OIDCIntegration is an auth mechanism that uses oidc. Spec:
  10. // https://openid.net/specs/openid-connect-core-1_0.html
  11. type OIDCIntegration struct {
  12. gorm.Model
  13. // The name of the auth mechanism
  14. Client OIDCIntegrationClient `json:"client"`
  15. // The id of the user that linked this auth mechanism
  16. UserID uint `json:"user_id"`
  17. // The project that this integration belongs to
  18. ProjectID uint `json:"project_id"`
  19. // ------------------------------------------------------------------
  20. // All fields encrypted before storage.
  21. // ------------------------------------------------------------------
  22. // The "Issuer Identifier" of the OIDC spec (16.15)
  23. IssuerURL []byte `json:"idp-issuer-url"`
  24. // The ID issued to the Relying Party
  25. ClientID []byte `json:"client-id"`
  26. // The secret issued to the Relying Party
  27. //
  28. // This is present because it used to be a required field in a kubeconfig.
  29. // However, because the kube apiserver acts as a Relying Party, the client
  30. // secret is not necessary.
  31. ClientSecret []byte `json:"client-secret"`
  32. // The CA data -- certificate check must be performed (16.17)
  33. CertificateAuthorityData []byte `json:"idp-certificate-authority-data"`
  34. // The user's JWT id token
  35. IDToken []byte `json:"id-token"`
  36. // The user's refresh token
  37. RefreshToken []byte `json:"refresh-token"`
  38. }