-
Notifications
You must be signed in to change notification settings - Fork 10
authentication
restaf supports sessions authenticated in one of these OAUTH2 flows
- PASSWORD flow
- AUTHORIZATION_CODE flow
- IMPLICIT flow
There are scenarios where the token might already exist. restaf will accept this token also.
The store.logon method establishes connection with SAS Viya.
await store.logon(payload);
The rest of this page discusses the form of payload for the various authentication flows
Password flow is typically used in cli's and nodejs applications.
let payload = {
authType : 'password',
host : 'http://your-viya-server',
user : username,
password : user password,
clientID : clientid, /* get this from your admin */
clientSecret: clientsecret /* get this from your admin */
} );
store.logon ( payload )
.then ( () => ...do whatever your app does ...)
.catch( err => ...do recovery ... )
In a browser session authenticated with authorization flow use the following payload
let payload = {
authType: 'server',
host : 'http://your-viya-server'
};
store.logon ( payload )
.then ( () => ...do whatever your app does ...)
.catch( err => ...do recovery ... )
When your app is running in a DDC the payload should be as follows:
let payload = {
authType: 'server',
host : window.location.origin
};
store.logon (payload)
.then ( () => ...do whatever your app does ...)
.catch( err => ...do recovery ... )
In your logon.html make this call.
let payload = {
host : <Viya server host (ex: http://my.example.com)
clientID : <clientid>
redirect : <your redirect uri>,
authType : 'implicit',
};
store.logon (payload)
.catch(err => ...do recovery ... )
This will result in the user being prompted for username and password.If successful the user will be redirected the redirect uri - which is the main entry of the application.
In the main entry of your application you will make the following call:
store.logon(null)
.then(...)
restaf will parse the url for the token and save it in the store.
There are situations where a valid token might exist(ex: you have created a long-lived token for running jobs as part of your CI/CD process) In that case use the following payload to store.logon
store.logon( {
authType: 'token',
host: "<your viya server>',
token: "<your token>"
});
If for some reason you need information on the authenticatiin for the session make the following call:
let c = store.connection();
The connection method returns information on the current connection.
Sample output:
{
"type": "trusted",
"host": "http://your-viya-host",
"tokenType": "bearer",
"token": "... your Oauth token ..."
}
.... 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