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/af9ab73c-0f12-4ddb-9016-0c640fab8ee6n%40apereo.org.

Reply via email to