Skip to content

Authentication

devakumaraswamy edited this page Jan 8, 2020 · 7 revisions

Authentication

restaf-server can be used in the following modes:

  1. As a web server for static assets with no authentication

  2. With authentication

    • Implicit flow authentication
    • Coming soon: authorization_code authentication

No authentication

The env and Dockerfile for this scenario is in /env/static directory.

Examples of the env and Dockerfile for this scenario are here

env file: https://github.com/sassoftware/restaf-server/blob/master/env/static/app.env

docker file: https://github.com/sassoftware/restaf-server/blob/master/env/static/Dockerfile

The key values are the EXPOSE for port number and the APPENTRY.

Implicit authentication

Starting with this release always set your clientid callback as follows:

http://yourip:yourport/callback
ex:
http://localhost:8080/callback

restaf-server will handle the callback and redirect to APPENTRY.

The previous behavior will still work - so no need to change immediately.

To use this scenario modify these files as follows:

env file

This is primarily used to override the values set in Dockerfile. Setting CLIENTID here is a good practice. A typical env file is shown below

VIYA_SERVER
CLIENTID=your-clientid 
APPENTRY=index.html
APPPORT= <if you need it to be something other than 8080> 
  • VIYA_SERVER: The Viya Server(http://...) can be set here or thru environment variables
  • APPENTRY: On successful authentication the user will be redirected to the entry specified by APPENTRY.
  • APPPORT: If not set here it will default to the value set by EXPOSE in the docker file. This should be sufficient for testing and a good thing when running in Docker. When running in docker override the default 8080 either in the docker run command or in the Dockercompose file.

Dockerfile

This is your standard Dockerfile

  1. Set the EXPOSE port to your desired port no. Set to 8080 when running in a docker container.
  2. Set the following to suit your needs
ENV APPHOST=<see note below>
ENV APPNAME=<see note below>
ENV APPLOC= typically ./public but it is where your assets are>
ENV APPENTRY=index.html or whatever your main entry is

APPNAME

Assign a meaningful name for your app.

APPHOST

This can be one of the following values:

localhost|*|ipAddress|dns-name-of-server

If set to *, restaf-server will resolve it to the dns name using nodejs function os.hostname.

APPLOC

This is the directory where restaf can find the static assets of your app. This is relative to the root of your application. Typically this is ./public

APPENTRY

After a successful logon restaf will redirect to this entry specified via APPLOC.

Clone this wiki locally