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)
... View more