-
Notifications
You must be signed in to change notification settings - Fork 10
Managing clientids
Application to manage clientids. The application runs as a cli. It can be run in interactive mode or non-interactive(batch) mode. The user of this app must have admin rights.
Do the following in any shell:
npx @sassoftware/registerclient --host=Url-to-viya-server --ttl=ttl_in-days
ex:
npx @sassoftware/registerclient --host=http://viya.unx.brilliant.sas.com --ttl=1
On prompt (>) enter
logon
Then respond to request for userid and password.
Once you are logged on issue "help" command to see what is possible.
Recommend that you use authorization_code flow for web applications. This will allow your application to use VA-SDK.
Here is an example;
add viyademo -t authorization_code -s secret -r http://localhost:8080/viyademo,http://localhost:8080/viyaapp,https://localhost/viyademo,https://localhost/viyaapp
Create password flow clientids
Here is an example:
add mycli -t password -s myclisecret
Create an env file ( call it register.env) with the following content
VIYA_SERVER=http://<your viyaserver>
AUTHTYPE=password
CLIENTID=sas.ec or a valid clientid( appears that sas.ec is shipped as a default clientid)
CLIENTSECRET=
Start the interactive session with this command:
npx @sassoftware/registerclient --env <your-env-file>
This will start an interactive session where you can issue commands. Use the exit command to end the session. Enter the following command:
logon
You will be prompted for your userid and password. Once you are logged on you can issue the commands discussed below.
- logon - logon on to Viya server. You will be prompted for userid and password
- list <all> - list current user-defined clientids. Use all option to additionally list system clientids
- del clientid - delete the specified clientid( always returns 404 but work - no idea why)
- add clientid < options > - add a new clientid
- -t == grant type == typically one of these: password | implicit | authorization_code)
- -s == secret whatever you want(valid for password and authorization_code)
- -r == redirect_uri == valid for implicit and authorization_code(if multiple redirects separate them by comma(,))
-
Create a password flow clientid
- add raf -t password -s raf
-
Create an implicit flow clientid
- add appi -t implicit -r http://localhost:8080/callback
-
Create a authorization_code flow clientid
- add appc -t authorization_code -s mysecret -r http://localhost:8080/yourappname,https://localhost:443/yourappname
-
list clientids including all SAS microservices clientids
- list all
-
list user clientids
- list
-
delete a specific client
- del appc
This mode is useful when you want to run these commands as part of some process. I use them to setup all my clientids when I am configuring a new server so that all my apps can run on it.
Create a version of the register.env file with two additional keys - USER and PASSWORD
VIYA_SERVER=http://<your viyaserver>
AUTHTYPE=password
CLIENTID=sas.ec or a valid clientid( appears that sas.ec is shipped as a default clientid)
CLIENTSECRET=
USER=<username>
PASSWORD=<password>
Run the following command
npx @sassoftware/registerclient --file yourcmdfile --env <your-env-file>
The cmd file contains a list of the commands(see below). They are executed in order.
list
add app1 -t implicit -r http://localhost:5000/app1
add app2 -t authorization_code -s mysecret -r http://localhost:5000/viyaapp
list
The current configuration for all clientids is shown below:
scope: ['openid', '*'],
resource_ids: 'none',
autoapprove: true,
access_token_validity: 86400,
'use-session': true
This can be changed with the config command
config <path to your config file>
This is only required if you want the cli to be installed in your local machine. Under normal circumstances this might not be necessary.
npm install -g @sassoftware/registerclient
This installs the cli as a global command
.... Under construction...
-
restaf
-
restaflib
-
Examples:
- Cas Server
- Compute Server
- Scoring with MAS
- Scoring with CAS
- Utility
-
CAS Related Functions
-
MAS Related Functions
-
Compute Server Related Functions
-
Reports Related Functions
-
Interactive CLI
-
Special Topic