There is a lot of context missing from your question.  You start by linking to 
JSON attribute definitions documentation.  Largely unrelated to the error you 
quote.


  1.  Are you trying to return an attribute value, via groovy scripting, in a 
service entry?
  2.  Or are you trying to rename an existing attribute to a new label via 
attribute definitions?

If you are trying to return an attribute with a new label, via groovy 
scripting, in a service entry (assumes original attribute named “giveName”):

…
attributeReleasePolicy:
{
@class: org.apereo.cas.services.ReturnMappedAttributeReleasePolicy
allowedAttributes:
{
@class: java.util.TreeMap
firstname:
[
java.util.ArrayList
[
‘’’
groovy{
return attributes[‘givenName’].get.(0)
}
‘’’
]
]

       }
}
…


If you are trying to use attribute definitions to rename an attribute label:

Do you have 
cas.authn.attribute-repository.attribute-definition-store.json.location defined 
in your cas.properties?
Would expect:

cas.authn.attribute-repository.attribute-definition-store.json.location=file:/etc/cas/config/attributes.json

And then the following snippet in attributes.json


{
"@class" : "java.util.TreeMap",
…
    "firstname" : {
      "@class" : 
"org.apereo.cas.authentication.attribute.DefaultAttributeDefinition",
      "key" : "firstname",
      "scoped" : false,
      "attribute" : "givenName"
    }
…
}

From: 'Matthew Gordon' via CAS Community <cas-user@apereo.org>
Sent: Tuesday, February 18, 2025 12:35 PM
To: CAS Community <cas-user@apereo.org>
Subject: [EXTERNAL SENDER] [cas-user] Embedded Script Groovy in Attribute 
definition

I am using this example for the JSON Attribute Definitions " Embedded Script" 
https://apereo.github.io/cas/7.0.x/integration/Attribute-Definitions.html

It does not appear to be working, and throws an error:

2025-02-18 11:03:12,125 WARN 
[org.apereo.cas.authentication.DefaultPrincipalAttributesMapper] - 
<Groovy-scripted attribute returned no value for [eduPersonPrincipalName]>
2025-02-18 11:03:12,132 ERROR [org.apereo.cas.util.scripting.GroovyShellScript] 
- <startup failed:
Script1.groovy: 1: Unexpected input: '}' @ line 1, column 109.
   Hi', attributes['firstname']] }, canonic
                                 ^

1 error

              ErrorCollector.java:failIfErrors:292
              ErrorCollector.java:addFatalError:148
              AstBuilder.java:collectSyntaxError:4753
              AstBuilder.java:access$100:169
>
2025-02-18 11:03:12,132 WARN 
[org.apereo.cas.authentication.DefaultPrincipalAttributesMapper] - 
<Groovy-scripted attribute returned no value for [eduPersonPrincipalName]>


Any idea what could be wrong?

Thank you,
Matt
--
- Website: https://apereo.github.io/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org<mailto:cas-user+unsubscr...@apereo.org>.
To view this discussion visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/bfdad1b8-8e51-48f0-8ede-8193f7d2192dn%40apereo.org<https://groups.google.com/a/apereo.org/d/msgid/cas-user/bfdad1b8-8e51-48f0-8ede-8193f7d2192dn%40apereo.org?utm_medium=email&utm_source=footer>.

-- 
- Website: https://apereo.github.io/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/DS7PR17MB6730AC4E616BF86014CE6F72B4C52%40DS7PR17MB6730.namprd17.prod.outlook.com.

Reply via email to