Skip to content

Commit

Permalink
Client scope / Include in token scope attribute (#339)
Browse files Browse the repository at this point in the history
* add include.in.token.scope client scope attribute

* add reference for include_in_token_scope

* remove default value to keep default value from keycloak
  • Loading branch information
wolfaba authored Feb 20, 2025
1 parent 149c85b commit eb4d42f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,14 @@ display.on.consent.screen

Default value: `true`

##### `include_in_token_scope`

Valid values: ``true``, ``false``

include.in.token.scope

Default value: `true`

##### `ensure`

Valid values: `present`, `absent`
Expand Down
3 changes: 3 additions & 0 deletions lib/puppet/provider/keycloak_client_scope/kcadm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def self.instances
attributes = d['attributes'] || {}
client_scope[:consent_screen_text] = attributes['consent.screen.text']
client_scope[:display_on_consent_screen] = attributes['display.on.consent.screen']
client_scope[:include_in_token_scope] = attributes['include.in.token.scope']
client_scopes << new(client_scope)
end
end
Expand All @@ -56,6 +57,7 @@ def create
attributes = {}
attributes['consent.screen.text'] = resource[:consent_screen_text]
attributes['display.on.consent.screen'] = resource[:display_on_consent_screen]
attributes['include.in.token.scope'] = resource[:include_in_token_scope]
data[:attributes] = attributes

t = Tempfile.new('keycloak_client_scope')
Expand Down Expand Up @@ -107,6 +109,7 @@ def flush
attributes = {}
attributes['consent.screen.text'] = @property_flush[:consent_screen_text] if @property_flush[:consent_screen_text]
attributes['display.on.consent.screen'] = @property_flush[:display_on_consent_screen] if @property_flush[:display_on_consent_screen]
attributes['include.in.token.scope'] = @property_flush[:include_in_token_scope] if @property_flush[:include_in_token_scope]
data[:attributes] = attributes if attributes

t = Tempfile.new('keycloak_client_scope')
Expand Down
5 changes: 5 additions & 0 deletions lib/puppet/type/keycloak_client_scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
defaultto :true
end

newproperty(:include_in_token_scope, boolean: true) do
desc 'include.in.token.scope'
newvalues(:true, :false)
end

def self.title_patterns
[
[
Expand Down
3 changes: 2 additions & 1 deletion spec/unit/puppet/type/keycloak_client_scope_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@

# Test boolean properties
[
:display_on_consent_screen
:display_on_consent_screen,
:include_in_token_scope
].each do |p|
it "accepts true for #{p}" do
config[p] = true
Expand Down

0 comments on commit eb4d42f

Please sign in to comment.