Skip to content

Commit ecc0046

Browse files
committed
Merge branch 'add-oauth-attribute-in-app' into 'master'
Support oauth_standard in cidaas app resource See merge request cidaas-management/terraform!149
2 parents ce40b2a + a0cc9fd commit ecc0046

File tree

7 files changed

+21
-65
lines changed

7 files changed

+21
-65
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Changelog
22

3+
### 3.5.2
4+
5+
### Enhancements
6+
7+
- Added `oauth_standard` attribute to the `cidaas_app` resource, allowing selection of the OAuth standard version between `OAuth2.0` and `OAuth2.1`.
8+
39
### 3.5.1
410

511
### Bug Fixes

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ resource "cidaas_app" "sample" {
390390
- `mfa` (Attributes) Configuration settings for Multi-Factor Authentication (MFA). (see [below for nested schema](#nestedatt--mfa))
391391
- `mfa_configuration` (String)
392392
- `mobile_settings` (Attributes) (see [below for nested schema](#nestedatt--mobile_settings))
393+
- `oauth_standard` (String) Specifies the OAuth standard version to use. Allowed values: 'OAuth2.1', 'OAuth2.0'.
393394
- `operations_allowed_groups` (Attributes List) (see [below for nested schema](#nestedatt--operations_allowed_groups))
394395
- `password_policy_ref` (String)
395396
- `pending_scopes` (Set of String)

docs/resources/app.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ resource "cidaas_app" "sample" {
265265
- `mfa` (Attributes) Configuration settings for Multi-Factor Authentication (MFA). (see [below for nested schema](#nestedatt--mfa))
266266
- `mfa_configuration` (String)
267267
- `mobile_settings` (Attributes) (see [below for nested schema](#nestedatt--mobile_settings))
268+
- `oauth_standard` (String) Specifies the OAuth standard version to use. Allowed values: 'OAuth2.1', 'OAuth2.0'.
268269
- `operations_allowed_groups` (Attributes List) (see [below for nested schema](#nestedatt--operations_allowed_groups))
269270
- `password_policy_ref` (String)
270271
- `pending_scopes` (Set of String)

helpers/cidaas/app.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ type AppModel struct {
135135
BackchannelLogoutSessionRequired *bool `json:"backchannel_logout_session_required,omitempty"`
136136
EnableLoginSpi *bool `json:"enable_login_spi,omitempty"`
137137
AcceptRolesInTheRegistration *bool `json:"accept_roles_in_the_registration,omitempty"`
138+
OauthStandard string `json:"oauthStandard,omitempty"`
138139

139140
// attributes not available in resource app schema
140141
TappID string `json:"tapp_id,omitempty"`

internal/resources/app_model.go

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ type AppConfig struct {
7272
BackgroundURI types.String `tfsdk:"background_uri"`
7373
VideoURL types.String `tfsdk:"video_url"`
7474
BotCaptchaRef types.String `tfsdk:"bot_captcha_ref"`
75+
OauthStandard types.String `tfsdk:"oauth_standard"`
7576

7677
EnableDeduplication types.Bool `tfsdk:"enable_deduplication"`
7778
AutoLoginAfterRegister types.Bool `tfsdk:"auto_login_after_register"`
@@ -234,71 +235,6 @@ type RoleFilter struct {
234235
Roles types.Set `tfsdk:"roles"`
235236
}
236237

237-
type CommonConfigs struct {
238-
CompanyName types.String `tfsdk:"company_name"`
239-
CompanyWebsite types.String `tfsdk:"company_website"`
240-
ClientType types.String `tfsdk:"client_type"`
241-
CompanyAddress types.String `tfsdk:"company_address"`
242-
243-
AllowedScopes types.Set `tfsdk:"allowed_scopes"`
244-
RedirectUris types.Set `tfsdk:"redirect_uris"`
245-
AllowedLogoutUrls types.Set `tfsdk:"allowed_logout_urls"`
246-
AllowedWebOrigins types.Set `tfsdk:"allowed_web_origins"`
247-
AllowedOrigins types.Set `tfsdk:"allowed_origins"`
248-
LoginProviders types.Set `tfsdk:"login_providers"`
249-
DefaultScopes types.Set `tfsdk:"default_scopes"`
250-
PendingScopes types.Set `tfsdk:"pending_scopes"`
251-
AllowedMfa types.Set `tfsdk:"allowed_mfa"`
252-
AllowedRoles types.Set `tfsdk:"allowed_roles"`
253-
DefaultRoles types.Set `tfsdk:"default_roles"`
254-
255-
SocialProviders types.List `tfsdk:"social_providers"`
256-
CustomProviders types.List `tfsdk:"custom_providers"`
257-
SamlProviders types.List `tfsdk:"saml_providers"`
258-
AdProviders types.List `tfsdk:"ad_providers"`
259-
AllowedGroups types.List `tfsdk:"allowed_groups"`
260-
OperationsAllowedGroups types.List `tfsdk:"operations_allowed_groups"`
261-
262-
// attributes with default value
263-
AccentColor types.String `tfsdk:"accent_color"`
264-
PrimaryColor types.String `tfsdk:"primary_color"`
265-
MediaType types.String `tfsdk:"media_type"`
266-
HostedPageGroup types.String `tfsdk:"hosted_page_group"`
267-
TemplateGroupID types.String `tfsdk:"template_group_id"`
268-
BotProvider types.String `tfsdk:"bot_provider"`
269-
LogoAlign types.String `tfsdk:"logo_align"`
270-
Webfinger types.String `tfsdk:"webfinger"`
271-
DefaultMaxAge types.Int64 `tfsdk:"default_max_age"`
272-
TokenLifetimeInSeconds types.Int64 `tfsdk:"token_lifetime_in_seconds"`
273-
IDTokenLifetimeInSeconds types.Int64 `tfsdk:"id_token_lifetime_in_seconds"`
274-
RefreshTokenLifetimeInSeconds types.Int64 `tfsdk:"refresh_token_lifetime_in_seconds"`
275-
AllowGuestLogin types.Bool `tfsdk:"allow_guest_login"`
276-
EnableDeduplication types.Bool `tfsdk:"enable_deduplication"`
277-
AutoLoginAfterRegister types.Bool `tfsdk:"auto_login_after_register"`
278-
EnablePasswordlessAuth types.Bool `tfsdk:"enable_passwordless_auth"`
279-
RegisterWithLoginInformation types.Bool `tfsdk:"register_with_login_information"`
280-
IsHybridApp types.Bool `tfsdk:"is_hybrid_app"`
281-
Enabled types.Bool `tfsdk:"enabled"`
282-
IsRememberMeSelected types.Bool `tfsdk:"is_remember_me_selected"`
283-
ResponseTypes types.Set `tfsdk:"response_types"`
284-
GrantTypes types.Set `tfsdk:"grant_types"`
285-
AllowLoginWith types.Set `tfsdk:"allow_login_with"`
286-
Mfa types.Object `tfsdk:"mfa"`
287-
}
288-
289-
type BasicSettings struct {
290-
ClientID types.String `tfsdk:"client_id"`
291-
RedirectURIs types.Set `tfsdk:"redirect_uris"`
292-
AllowedLogoutUrls types.Set `tfsdk:"allowed_logout_urls"`
293-
AllowedScopes types.Set `tfsdk:"allowed_scopes"`
294-
ClientSecrets types.List `tfsdk:"client_secrets"`
295-
}
296-
297-
type ClientSecret struct {
298-
ClientSecret types.String `tfsdk:"client_secret"`
299-
ClientSecretExpiresAt types.Int64 `tfsdk:"client_secret_expires_at"`
300-
}
301-
302238
func (w *AppConfig) ExtractAppConfigs(ctx context.Context) diag.Diagnostics {
303239
var diags diag.Diagnostics
304240
if !w.LoginSpi.IsNull() && !w.LoginSpi.IsUnknown() {
@@ -446,6 +382,7 @@ func prepareAppModel(ctx context.Context, plan AppConfig) (*cidaas.AppModel, dia
446382
BackchannelLogoutSessionRequired: plan.BackchannelLogoutSessionRequired.ValueBoolPointer(),
447383
AcceptRolesInTheRegistration: plan.AcceptRolesInTheRegistration.ValueBoolPointer(),
448384
PasswordPolicyRef: plan.PasswordPolicyRef.ValueString(),
385+
OauthStandard: plan.OauthStandard.ValueString(),
449386
}
450387

451388
var diags diag.Diagnostics

internal/resources/app_schema.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ var resourceAppSchema = schema.Schema{
9090
Optional: true,
9191
MarkdownDescription: "Redirect URIs for OAuth2 client.",
9292
},
93+
"oauth_standard": schema.StringAttribute{
94+
Optional: true,
95+
MarkdownDescription: "Specifies the OAuth standard version to use. Allowed values: 'OAuth2.1', 'OAuth2.0'",
96+
Validators: []validator.String{
97+
stringvalidator.OneOf([]string{"OAuth2.1", "OAuth2.0"}...),
98+
},
99+
},
93100
// optional for NON_INTERACTIVE/IOS/ANDROID/DESKTOP/MOBILE/WINDOWS_MOBILE/DEVICE
94101
"allowed_logout_urls": schema.SetAttribute{
95102
ElementType: types.StringType,

internal/resources/resource_app.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ func updateAppState(state *AppConfig, resp cidaas.AppResponse, isImport bool) {
319319
if !state.BotProvider.IsNull() || isImport {
320320
state.BotProvider = util.StringValueOrNull(&data.BotProvider)
321321
}
322+
if !state.OauthStandard.IsNull() || isImport {
323+
state.OauthStandard = util.StringValueOrNull(&data.OauthStandard)
324+
}
322325

323326
// Boolean attributes
324327
if !state.AllowGuestLogin.IsNull() || isImport {

0 commit comments

Comments
 (0)