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
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/418d9bba-16fb-46c1-9f02-6bd3db245c7bn%40apereo.org.

Reply via email to