PS: I was able to use simple groovy scripts (inline in service definitions 
and scripts with their own files) in the past with the current setup I have

On Tuesday, August 2, 2022 at 4:03:56 PM UTC+3 Emilian Mitocariu wrote:

> I didn't install groovy directly on my server, CAS (version 6.5.6 in my 
> case) comes with jars for groovy 3.0.9
>
> Here's a list of all the groovy related jars that came with my CAS build:
>  - groovy-3.0.9.jar
>  - groovy-datetime-3.0.9.jar
>  - groovy-extensions-1.1.0.jar
>  - groovy-groovysh-3.0.9.jar
>  - groovy-json-3.0.9.jar
>  - groovy-jsr223-3.0.9.jar
>  - groovy-sql-3.0.9.jar
>  - groovy-templates-3.0.9.jar
>  - groovy-xml-3.0.9.jar
>
> On Monday, August 1, 2022 at 11:11:48 PM UTC+3 Stewart wrote:
>
>> Hi Emilian,
>>
>> I don't have any specific ivy dependencies configured.  I'd expect that 
>> to come with a full groovy install.  What version of groovy are you using? 
>>
>> Regards,
>>
>> Stewart
>>
>> On Mon, Aug 1, 2022 at 8:16 AM Emilian Mitocariu <[email protected]> 
>> wrote:
>>
>>> Hi Steward,
>>>
>>> Did you add a dependency when building CAS for that *@Grab(* line in 
>>> the groovy script? Because when I add that line in my groovy script (no 
>>> other code, just that line) CAS fails to start with error 
>>> "java.lang.ClassNotFoundException: org.apache.ivy.util.MessageLogger".
>>>
>>> A search for that error point to `org.apache.ivy` being needed.
>>>
>>> On Friday, July 2, 2021 at 5:06:17 PM UTC+3 Stewart wrote:
>>>
>>>> Hi Mohammad,
>>>>
>>>> Here are the settings that work for us under 6.1.6 (with sensitive 
>>>> information redacted).  I've included the groovy script we use too...we 
>>>> send messages via Flowroute (a voip provider).  I hope this helps.
>>>>
>>>> Regards,
>>>>
>>>> Stewart
>>>>
>>>> cas.authn.mfa.simple.name=mfa-simple
>>>> cas.authn.mfa.simple.order=0
>>>> cas.authn.mfa.simple.timeToKillInSeconds=60
>>>> cas.authn.mfa.simple.tokenLength=6
>>>> [email protected]
>>>> cas.authn.mfa.simple.mail.text=Your one-time authorization token is: %s
>>>> cas.authn.mfa.simple.mail.subject=Authorization Token
>>>> cas.authn.mfa.simple.sms.from=12125551212 <(212)%20555-1212>
>>>> cas.authn.mfa.simple.sms.text=Your one-time authorization token is: %s
>>>> cas.authn.mfa.simple.sms.attributeName=mobile
>>>> cas.smsProvider.groovy.location=file:/etc/cas/sendSms.groovy
>>>>
>>>> --- sendSms.groovy ---
>>>> @Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 
>>>> 'http-builder', v ersion = '0.7.1')
>>>> import java.util.*
>>>>   import groovyx.net.http.RESTClient
>>>> import static groovyx.net.http.ContentType.JSON
>>>> import groovy.json.JsonSlurper
>>>>
>>>> class smsSender {
>>>>   def run(Object[] args) {
>>>>     def from = args[0]
>>>>     def to = args[1]
>>>>     def message = args[2]
>>>>     def logger = args[3]
>>>>
>>>>     logger.debug("Sending message ${message} to ${to} from ${from}")
>>>>     RESTClient client = new RESTClient("https://api.flowroute.com/v2/
>>>> ".toString())
>>>>     def jsonObj = new JsonSlurper().parseText('{"to": "${to}", "from": 
>>>> "${from}", "body": "${message}"
>>>>     }
>>>>     ')
>>>>     def path = "messages"
>>>>     client.auth.basic("XXXXXX", "<long key here> ")
>>>>     def response = client.post(
>>>>       path: path,
>>>>       contentType: JSON,
>>>>       requestContentType: JSON,
>>>>       body: jsonObj,
>>>>     )
>>>>
>>>>     return response.status
>>>>
>>>>   }
>>>> }
>>>>
>>>> On Thursday, July 1, 2021 at 3:16:06 AM UTC-5 mohammad almodallal wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>>  anyone could help on how to send SMS for OTP using a custom java or 
>>>>> script on CAS 6.3.x or 6.1.x?
>>>>>
>>>>> thanks
>>>>>
>>>>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/a093f411-47f1-45fc-a41b-260b1746a453n%40apereo.org.

Reply via email to