feat: add AllowedCorsOrigins (#58)

This commit is contained in:
Jonathan Lima
2020-06-29 05:56:40 -03:00
committed by GitHub
parent e626afcc04
commit 53aea68766
4 changed files with 16 additions and 0 deletions

View File

@ -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),

View File

@ -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))