mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-09 00:09:43 +00:00
discovery configuration
This commit is contained in:
@@ -8,18 +8,41 @@ import (
|
||||
)
|
||||
|
||||
type MyIdProvider struct {
|
||||
keyPair *selfhosted.KeyPair
|
||||
jwk *selfhosted.JWK
|
||||
jwk *selfhosted.JWK
|
||||
issuerHostPath string
|
||||
}
|
||||
|
||||
func (p *MyIdProvider) Discovery() []byte {
|
||||
return []byte{}
|
||||
type OIDCDiscoveryConfiguration struct {
|
||||
Issuer string `json:"issuer"`
|
||||
JWKSURI string `json:"jwks_uri"`
|
||||
AuthorizationEndpoint string `json:"authorization_endpoint"`
|
||||
ResponseTypesSupported []string `json:"response_types_supported"`
|
||||
SubjectTypesSupported []string `json:"subject_types_supported"`
|
||||
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported"`
|
||||
ClaimsSupported []string `json:"claims_supported"`
|
||||
}
|
||||
|
||||
func (p *MyIdProvider) Discovery() ([]byte, error) {
|
||||
oidcConfig := OIDCDiscoveryConfiguration{
|
||||
Issuer: fmt.Sprintf("https://%s/", p.issuerHostPath),
|
||||
JWKSURI: fmt.Sprintf("https://%s/keys.json", p.issuerHostPath),
|
||||
AuthorizationEndpoint: "urn:kubernetes:programmatic_authorization",
|
||||
ResponseTypesSupported: []string{"id_token"},
|
||||
SubjectTypesSupported: []string{"public"},
|
||||
IDTokenSigningAlgValuesSupported: []string{"RS256"},
|
||||
ClaimsSupported: []string{"sub", "iss"},
|
||||
}
|
||||
jsonData, err := json.MarshalIndent(oidcConfig, "", " ")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return jsonData, nil
|
||||
}
|
||||
|
||||
func (p *MyIdProvider) JWK() ([]byte, error) {
|
||||
jsonData, err := json.MarshalIndent(p.jwk.GetKeys(), "", " ")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error marshalling JSON: %s", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
return jsonData, nil
|
||||
}
|
||||
@@ -28,6 +51,6 @@ func (p *MyIdProvider) Endpoint() []byte {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
func NewMyIdProvider(keyPair *selfhosted.KeyPair, jwk *selfhosted.JWK) *MyIdProvider {
|
||||
return &MyIdProvider{keyPair, jwk}
|
||||
func NewMyIdProvider(jwk *selfhosted.JWK, issuerHostPath string) *MyIdProvider {
|
||||
return &MyIdProvider{jwk, issuerHostPath}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user