<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Lua authentication with SSO in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/Lua-authentication-with-SSO/m-p/785988#M23537</link>
    <description>&lt;P&gt;I would like to connect to CAS from lua code, but we do use SSO authentication instead of user/password.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the &lt;A href="https://sassoftware.github.io/python-swat/generated/swat.cas.connection.CAS.html" target="_self"&gt;swat documentation&amp;nbsp;&lt;/A&gt;&amp;nbsp;I found a parameter&amp;nbsp;&lt;EM class="sig-param"&gt;authcode=None.&lt;/EM&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;authcode&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN class="classifier"&gt;string&lt;/SPAN&gt;&lt;SPAN class="opt-sep"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="optional"&gt;optional&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Authorization code from SASLogon used to retrieve an OAuth token.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think this is the parameter I need. To generate authcode I need to log in into SAS Logon with the correct client_id.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example of my understanding:&lt;/P&gt;
&lt;P&gt;For login to CLI I generate a code with &lt;EM&gt;client_id=sas.cli&lt;/EM&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="pl"&gt;&lt;A href="https://sas-dev.health.fgov.be/SASLogon/oauth/authorize?client_id=sas.cli&amp;amp;response_type=code" target="_blank"&gt;https://&amp;lt;cashost&amp;gt;/SASLogon/oauth/authorize?client_id=sas.cli&amp;amp;response_type=code&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Then I use the code from browser in CLI for authentication.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When we use login/password everything works, but we need it for SSO. How can I login into cas using SWAT, lua and OAuth?&lt;/P&gt;
&lt;P&gt;There is&amp;nbsp;&lt;EM class="sig-param"&gt;authcode= &lt;/EM&gt;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.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I try to connect to CAS with user/pass from SSO it doesn't work (as expected):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;82   proc lua;
83   submit;
84   swat_enabled = true
85   cas = require "swat"
86   s=cas.open("&amp;lt;cashost&amp;gt;",5570,'&amp;lt;user&amp;gt;','&amp;lt;pass&amp;gt;' )
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 '&amp;lt;cashost&amp;gt;' 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 &amp;lt;/sasdata/DEV/lua/deps/middleclass.lua:128&amp;gt;
(...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&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question is:&lt;/P&gt;
&lt;P&gt;To generate a code for&amp;nbsp;&lt;EM class="sig-param"&gt;authcode &lt;/EM&gt;I should know the client_id. What client_id I can use?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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)&lt;/P&gt;</description>
    <pubDate>Tue, 14 Dec 2021 12:31:11 GMT</pubDate>
    <dc:creator>idziemianczyk</dc:creator>
    <dc:date>2021-12-14T12:31:11Z</dc:date>
    <item>
      <title>Lua authentication with SSO</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Lua-authentication-with-SSO/m-p/785988#M23537</link>
      <description>&lt;P&gt;I would like to connect to CAS from lua code, but we do use SSO authentication instead of user/password.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the &lt;A href="https://sassoftware.github.io/python-swat/generated/swat.cas.connection.CAS.html" target="_self"&gt;swat documentation&amp;nbsp;&lt;/A&gt;&amp;nbsp;I found a parameter&amp;nbsp;&lt;EM class="sig-param"&gt;authcode=None.&lt;/EM&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;authcode&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN class="classifier"&gt;string&lt;/SPAN&gt;&lt;SPAN class="opt-sep"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="optional"&gt;optional&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Authorization code from SASLogon used to retrieve an OAuth token.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think this is the parameter I need. To generate authcode I need to log in into SAS Logon with the correct client_id.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example of my understanding:&lt;/P&gt;
&lt;P&gt;For login to CLI I generate a code with &lt;EM&gt;client_id=sas.cli&lt;/EM&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;" lang="pl"&gt;&lt;A href="https://sas-dev.health.fgov.be/SASLogon/oauth/authorize?client_id=sas.cli&amp;amp;response_type=code" target="_blank"&gt;https://&amp;lt;cashost&amp;gt;/SASLogon/oauth/authorize?client_id=sas.cli&amp;amp;response_type=code&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Then I use the code from browser in CLI for authentication.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When we use login/password everything works, but we need it for SSO. How can I login into cas using SWAT, lua and OAuth?&lt;/P&gt;
&lt;P&gt;There is&amp;nbsp;&lt;EM class="sig-param"&gt;authcode= &lt;/EM&gt;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.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I try to connect to CAS with user/pass from SSO it doesn't work (as expected):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;82   proc lua;
83   submit;
84   swat_enabled = true
85   cas = require "swat"
86   s=cas.open("&amp;lt;cashost&amp;gt;",5570,'&amp;lt;user&amp;gt;','&amp;lt;pass&amp;gt;' )
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 '&amp;lt;cashost&amp;gt;' 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 &amp;lt;/sasdata/DEV/lua/deps/middleclass.lua:128&amp;gt;
(...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&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question is:&lt;/P&gt;
&lt;P&gt;To generate a code for&amp;nbsp;&lt;EM class="sig-param"&gt;authcode &lt;/EM&gt;I should know the client_id. What client_id I can use?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 12:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Lua-authentication-with-SSO/m-p/785988#M23537</guid>
      <dc:creator>idziemianczyk</dc:creator>
      <dc:date>2021-12-14T12:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Lua authentication with SSO</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Lua-authentication-with-SSO/m-p/786017#M23542</link>
      <description>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.&lt;BR /&gt;&lt;BR /&gt;Getting Started with SAS® Viya® for Lua&lt;BR /&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmcdc/8.11/caspg3lua/titlepage.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmcdc/8.11/caspg3lua/titlepage.htm&lt;/A&gt;</description>
      <pubDate>Tue, 14 Dec 2021 16:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Lua-authentication-with-SSO/m-p/786017#M23542</guid>
      <dc:creator>gwootton</dc:creator>
      <dc:date>2021-12-14T16:00:44Z</dc:date>
    </item>
  </channel>
</rss>

