Unable to send SMS via REST interface

84 views
Skip to first unread message

Stewart

unread,
Feb 28, 2020, 7:44:18 PM2/28/20
to CAS Community
Hi All,

Using CAS 6.1.4, I've been attempting to get the "simple multifactor authentication" to send SMS via a RESTful interface.  I'm able to get it to send via email, and I'm able to curl the provider with a hand-crafted version of the JSON that CAS should be sending - both work, but it appears that that the REST call is never sent from CAS for sending SMS.  The log files are not helpful (they simple say that CAS failed to send via SMS or Mail).  My configuration is:

cas.authn.mfa.simple=mfa-simple
cas
.authn.mfa.simple.order=2
cas
.authn.mfa.simple.timeToKillInSeconds=60
cas
.authn.mfa.simple.tokenLength=6
cas
.authn.mfa.simple.sms.from=1XXXXXXXXXX
cas
.authn.mfa.simple.sms.text=Your one-time authorization token is: %s
cas
.authn.mfa.simple.sms.attributeName=mobile
cas
.smsProvider.rest.method=POST
cas
.smsProvider.rest.basicAuthUsername=XXXXXXXXX
cas
.smsProvider.rest.basicAuthPassword=XXXXXXXXXXXXXXXXXXXX
cas
.smsProvider.rest.url=https://myprovider.com/endpoint
The log files show the attribute 'mobile' has the proper value in it.

Has anyone managed to get this working?  What am I doing incorrectly?

Stewart

unread,
Mar 4, 2020, 1:34:25 PM3/4/20
to CAS Community
Well, looks worse than I originally thought.  I'm unable to (broken? or am I doing something wrong) get ANY SMS provider to be called when configured.

artur mis

unread,
Jul 4, 2024, 6:03:53 AMJul 4
to CAS Community, Stewart
Have you managed this?  I looking for solution  mfa+sms,  sms providers not form the  appero  payable  list. It looks the sms-provider could be  managable but i struugle with it too . I think the problem is to flow to sms-provider  but who knows.

Y G

unread,
Jul 4, 2024, 10:55:30 AMJul 4
to CAS Community, artur mis, Stewart
Hello, docs here https://apereo.github.io/cas/6.6.x/notifications/SMS-Messaging-Configuration-REST.html says that it just sends with these arguments and expects a HTTP 200 return from it, now i don't know if this works with 6.1.4, but if it does, i'm guessing you may need to write a mini adapter like service to convert and relay the information to your provider. I asked for an example from ai: https://g.co/gemini/share/120e27a43fb7

Or if you have time and patience to generate an overlay project and set up CommunicationsManager and SmsSender to your needs, you can have that option too.

Hope it helps.

4 Temmuz 2024 Perşembe tarihinde saat 13:03:53 UTC+3 itibarıyla artur mis şunları yazdı:

artur mis

unread,
Jul 8, 2024, 12:20:48 PMJul 8
to CAS Community, Y G, artur mis, Stewart
Thank you Stewart

I see  only 200 how you said :
Probably it is about  this 200 :
2024-07-08 15:19:16,754 DEBUG [org.springframework.web.servlet.DispatcherServlet] - <Completed 200 OK>
2024-07-08 15:21:14,297 DEBUG [org.apereo.cas.ticket.registry.DefaultTicketRegistryCleaner] - <Cleaning up expired ticket [CASMFA-297739]>

During the flow process  we can't  see  POST request in logs   what is builded by cas, flow is not talkative   , but i can see via tcpdump  https communication with sms gate so we don't know  what cas is sending.    It would be beautifull if devlopers  improve this proces and share their precious knowledge :) .    I don't know if i can manage this  solution which you described, so we wil see.

Finally: Maybe there is second way to send sms  via groovy script but it will be too  not easy  to achive.   We can say that  without  beeing familiar with Sping Boot  it is not possible  to  set in cas v6.5 and  v7.1.0  simple-mfa with rest api  text (SMS):

 
Dep like this:

    implementation "org.apereo.cas:cas-server-support-simple-mfa"
    implementation "org.apereo.cas:cas-server-core-notifications"



Setting  cas.properties:


cas.authn.mfa.simple.name=SMS MFA
cas.authn.mfa.simple.order=0
cas.authn.mfa.simple.sms.attribute-name=phone
cas.authn.mfa.simple.sms.from=xxxxxxx
cas.authn.mfa.simple.sms.text=Your one-time authorization token is ${token}
cas.authn.mfa.simple.time-to-kill-in-seconds=120
cas.authn.mfa.simple.token-length=6


cas.sms-provider.rest.method=POST
cas.sms-provider.rest.basic-auth-username=webapi
cas.sms-provider.rest.basic-auth-password=xxxxxxxxxxxx
cas.sms-provider.rest.url=https://api2.xxxxxx/messages/send_sms
cas.sms-provider.rest.headers.Content-Type=application/x-www-form-urlencoded




One more time thank you Stewart.
Reply all
Reply to author
Forward
0 new messages