Skip to content

Commit

Permalink
fix client references to list attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
dcreado committed Jan 10, 2023
1 parent 7eca13c commit 24cb64a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 6 additions & 6 deletions internal/provider/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func clientUpdate(ctx context.Context, d *schema.ResourceData, meta interface{})
}
}
if d.HasChange("redirect_uris") {
existingClient.SetRedirectUris(mapSetToString(d.Get("redirect_uris").([]interface{})))
existingClient.SetRedirectUris(mapSetToString(d.Get("redirect_uris").(*schema.Set).List()))
}
if d.HasChange("response_types") {
existingClient.SetResponseTypes(mapResponseTypesToDTO(d.Get("response_types").([]interface{})))
Expand All @@ -225,7 +225,7 @@ func clientUpdate(ctx context.Context, d *schema.ResourceData, meta interface{})
}
}
if d.HasChange("contacts") {
existingClient.SetContacts(mapSetToString(d.Get("contacts").([]interface{})))
existingClient.SetContacts(mapSetToString(d.Get("contacts").(*schema.Set).List()))
}
if d.HasChange("client_name") {
if NotZeroString(d, "client_name") {
Expand Down Expand Up @@ -395,7 +395,7 @@ func clientUpdate(ctx context.Context, d *schema.ResourceData, meta interface{})
existingClient.SetDefaultMaxAge(int32(d.Get("default_max_age").(int)))
}
if d.HasChange("default_acrs") {
existingClient.SetDefaultAcrs(mapSetToString(d.Get("default_acrs").([]interface{})))
existingClient.SetDefaultAcrs(mapSetToString(d.Get("default_acrs").(*schema.Set).List()))
}
if d.HasChange("auth_time_required") {
existingClient.SetAuthTimeRequired(d.Get("auth_time_required").(bool))
Expand All @@ -408,7 +408,7 @@ func clientUpdate(ctx context.Context, d *schema.ResourceData, meta interface{})
}
}
if d.HasChange("request_uris") {
existingClient.SetRequestUris(mapSetToString(d.Get("request_uris").([]interface{})))
existingClient.SetRequestUris(mapSetToString(d.Get("request_uris").(*schema.Set).List()))
}
if d.HasChange("description") {
if NotZeroString(d, "description") {
Expand All @@ -425,7 +425,7 @@ func clientUpdate(ctx context.Context, d *schema.ResourceData, meta interface{})

ext := authlete.NewClientExtension()
ext.SetRequestableScopesEnabled(d.Get("requestable_scopes_enabled").(bool))
ext.SetRequestableScopes(mapSetToString(d.Get("requestable_scopes").([]interface{})))
ext.SetRequestableScopes(mapSetToString(d.Get("requestable_scopes").(*schema.Set).List()))
ext.SetAccessTokenDuration(int64(d.Get("access_token_duration").(int)))
ext.SetRefreshTokenDuration(int64(d.Get("refresh_token_duration").(int)))
existingClient.SetExtension(*ext)
Expand Down Expand Up @@ -545,7 +545,7 @@ func clientUpdate(ctx context.Context, d *schema.ResourceData, meta interface{})
}
}
if d.HasChange("authorization_details_types") {
existingClient.SetAuthorizationDetailsTypes(mapSetToString(d.Get("authorization_details_types").([]interface{})))
existingClient.SetAuthorizationDetailsTypes(mapSetToString(d.Get("authorization_details_types").(*schema.Set).List()))
}
if d.HasChange("par_required") {
existingClient.SetParRequired(d.Get("par_required").(bool))
Expand Down
6 changes: 5 additions & 1 deletion internal/provider/constants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,10 @@ resource "authlete_service" "prod" {
default_entry = false
}
supported_scopes {
name = "scope3"
default_entry = false
}
}
Expand All @@ -834,7 +838,7 @@ resource "authlete_client" "client1" {
response_types = [ "CODE" ]
grant_types = [ "AUTHORIZATION_CODE", "REFRESH_TOKEN" ]
client_name = "Authlete client"
requestable_scopes = ["scope1", "scope2"]
requestable_scopes = ["scope1", "scope2", "scope3"]
jwk {
kid = "rsa1"
Expand Down

0 comments on commit 24cb64a

Please sign in to comment.