feat: add AllowedCorsOrigins (#58)
This commit is contained in:
parent
e626afcc04
commit
53aea68766
@ -91,6 +91,9 @@ type OAuth2ClientSpec struct {
|
||||
// PostLogoutRedirectURIs is an array of the post logout redirect URIs allowed for the application
|
||||
PostLogoutRedirectURIs []RedirectURI `json:"postLogoutRedirectUris,omitempty"`
|
||||
|
||||
// AllowedCorsOrigins is an array of allowed CORS origins
|
||||
AllowedCorsOrigins []RedirectURI `json:"allowedCorsOrigins,omitempty"`
|
||||
|
||||
// Audience is a whitelist defining the audiences this client is allowed to request tokens for
|
||||
Audience []string `json:"audience,omitempty"`
|
||||
|
||||
@ -185,6 +188,7 @@ func (c *OAuth2Client) ToOAuth2ClientJSON() *hydra.OAuth2ClientJSON {
|
||||
ResponseTypes: responseToStringSlice(c.Spec.ResponseTypes),
|
||||
RedirectURIs: redirectToStringSlice(c.Spec.RedirectURIs),
|
||||
PostLogoutRedirectURIs: redirectToStringSlice(c.Spec.PostLogoutRedirectURIs),
|
||||
AllowedCorsOrigins: redirectToStringSlice(c.Spec.AllowedCorsOrigins),
|
||||
Audience: c.Spec.Audience,
|
||||
Scope: c.Spec.Scope,
|
||||
Owner: fmt.Sprintf("%s/%s", c.Name, c.Namespace),
|
||||
|
@ -121,6 +121,11 @@ func (in *OAuth2ClientSpec) DeepCopyInto(out *OAuth2ClientSpec) {
|
||||
*out = make([]RedirectURI, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.AllowedCorsOrigins != nil {
|
||||
in, out := &in.AllowedCorsOrigins, &out.AllowedCorsOrigins
|
||||
*out = make([]RedirectURI, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Audience != nil {
|
||||
in, out := &in.Audience, &out.Audience
|
||||
*out = make([]string, len(*in))
|
||||
|
@ -387,6 +387,12 @@ spec:
|
||||
type: object
|
||||
spec:
|
||||
properties:
|
||||
allowedCorsOrigins:
|
||||
description: AllowedCorsOrigins is an array of allowed CORS origins
|
||||
items:
|
||||
pattern: \w+:/?/?[^\s]+
|
||||
type: string
|
||||
type: array
|
||||
audience:
|
||||
description: Audience is a whitelist defining the audiences this client
|
||||
is allowed to request tokens for
|
||||
|
@ -14,6 +14,7 @@ type OAuth2ClientJSON struct {
|
||||
GrantTypes []string `json:"grant_types"`
|
||||
RedirectURIs []string `json:"redirect_uris,omitempty"`
|
||||
PostLogoutRedirectURIs []string `json:"post_logout_redirect_uris,omitempty"`
|
||||
AllowedCorsOrigins []string `json:"allowed_cors_origins,omitempty"`
|
||||
ResponseTypes []string `json:"response_types,omitempty"`
|
||||
Audience []string `json:"audience,omitempty"`
|
||||
Scope string `json:"scope"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user