BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
idziemianczyk
Obsidian | Level 7

I would like to connect to CAS from lua code, but we do use SSO authentication instead of user/password.

 

In the swat documentation  I found a parameter authcode=None.

authcode string, optional

Authorization code from SASLogon used to retrieve an OAuth token.

 

I think this is the parameter I need. To generate authcode I need to log in into SAS Logon with the correct client_id.

 

Example of my understanding:

For login to CLI I generate a code with client_id=sas.cli

https://<cashost>/SASLogon/oauth/authorize?client_id=sas.cli&response_type=code

Then I use the code from browser in CLI for authentication.

 

When we use login/password everything works, but we need it for SSO. How can I login into cas using SWAT, lua and OAuth?

There is authcode= option, but I don't know how to generate such a code. At the same time I don't have LDAP user to check if user/password works. 

 

 

When I try to connect to CAS with user/pass from SSO it doesn't work (as expected):

 

82   proc lua;
83   submit;
84   swat_enabled = true
85   cas = require "swat"
86   s=cas.open("<cashost>",5570,'<user>','<pass>' )
87   print("NOTE: s=", s)
88   endsubmit;
89   run;
NOTE: Resuming Lua state from previous PROC LUA invocation.
ERROR: Connection failed. Server returned: SAS Logon Manager authentication failed: Access denied.
ERROR: /sasdata/DEV/lua/swat.lua:193: Could not connect to '<cashost>' on port 5570.
stack traceback:
[C]: in function 'error'
/sasdata/DEV/lua/swat.lua:193: in function 'errorcheck'
/sasdata/DEV/lua/swat.lua:2107: in function 'initialize'
/sasdata/DEV/lua/deps/middleclass.lua:131: in function </sasdata/DEV/lua/deps/middleclass.lua:128>
(...tail calls...)
SUBMIT block:3: in main chunk
ERROR: There was an error submitting the provided code
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE LUA used (Total process time):
      real time           0.23 seconds
      cpu time            0.01 seconds

 

 

The question is:

To generate a code for authcode I should know the client_id. What client_id I can use? 

If I'm in mistake. How can I connect to CAS with LUA code without LDAP account?(for eg I can create a new client_id, but I don't see the way to use it in LUA code)

1 ACCEPTED SOLUTION

Accepted Solutions
gwootton
SAS Super FREQ
The documentation you are referencing is for python-swat. The Lua swat package does not appear have a authcode option, only an authinfo file or user/password.

Getting Started with SAS® Viya® for Lua
https://go.documentation.sas.com/doc/en/pgmcdc/8.11/caspg3lua/titlepage.htm
--
Greg Wootton | Principal Systems Technical Support Engineer

View solution in original post

1 REPLY 1
gwootton
SAS Super FREQ
The documentation you are referencing is for python-swat. The Lua swat package does not appear have a authcode option, only an authinfo file or user/password.

Getting Started with SAS® Viya® for Lua
https://go.documentation.sas.com/doc/en/pgmcdc/8.11/caspg3lua/titlepage.htm
--
Greg Wootton | Principal Systems Technical Support Engineer

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 492 views
  • 0 likes
  • 2 in conversation