dev:010how:120websrv:0350autmod

Library for WEB-Authentication

Module AUTMOD Library for WEB-Authentication

Description

Library for for API authentication.
Included into RSTMOD. Can be used by other (e.g. customer-specific) modules that require HTTP-authentication.

Supported types:
* No authentication
* Basic - login/password
* X-CSRF-TOKEN - Cross-Site Request Forgery token
* OAuth 2.0

The module is very similar to RSTMOD in terms of design approaches


Properties

Property YES/NO
Single page frame No
Show toolbar No
Show menu No
Show statusbar No
Show hint No
Fit panel size No

Datafields

Name Description Data Type Len Dec. View lines View type Inst. Visible Codetable
PANSTA Panel Status 'E'dit 'I'nfo Text 1 1 Edit Yes Public
USR User Text 40 1 Edit Yes Public
PWD Password Text 40 1 Edit Yes Public
NAME Name Text 100 1 Edit Yes Public
URL Endpoint URL Block 64 32 4 Block Yes Private
STMOUT Output Stream 1 0 Source Yes Public
STMDBG Debug Stream 1 0 Source Yes Public
SRVPNT Parent Module of the Instance Text 10 1 Edit Yes Public
FMT Format Text 4 1 Edit Yes Public Embedded
BUTTST Get Token Control 16 1 Button Yes Public
TAGTKN JSON tag of token Text 40 1 Edit Yes Public
HDRNAM Name of headertag for token Text 40 1 Edit Yes Public
AUTHTYP Authorization type Text 10 1 Edit Yes Public Embedded
USRLBL User Label Text 40 1 Edit Yes Public
PWDLBL Password Label Text 40 1 Edit Yes Public
BUTBACK Back Control 16 1 Button Yes Public
LBLVBS Label for Verbose Folder Text 100 1 Edit Yes Private
DBGSAV Save Debug Info Text 1 1 Edit Yes Public
REQSAV Save Request Text 1 1 Edit Yes Public
RESSAV Save Response Text 1 1 Edit Yes Public
CLIID Client Id Text 40 1 Edit Yes Public
CLISEC Client Secret Text 40 1 Edit Yes Public
CURURL Current URL for calling Block 64 32 Block Yes Private
PARURL Parameters for URL Block 64 32 Block Yes Private
SRVNAM Rest Instance Name Text 10 1 Edit Yes Private
FMTREQ Request Content Type Text 4 1 Edit Yes Public Embedded
FMTRES Response Content Type Text 4 1 Edit Yes Public Embedded
GNTTYP Grant Type Text 6 1 Edit Yes Public Embedded
SCP Scope Text 80 1 Edit Yes Public

Datafield Description and Properties

Datafield USR User

Description

This field is used for User for Basic and CSRF authentication types

For OAuth 2.0 this field is used for client ID


Datafield PWD Password

Description

This field is used for Password for Basic and CSRF authentication types

For OAuth 2.0 this field is used for client secret


Datafield NAME Name

Description

Indicates the name of panel for authentication settings. Derived from parent module


Datafield URL Endpoint URL

Description

URL for base endpoint. Used for retrieving security tokens.

Maximum size 2048


Datafield STMOUT Output

Description

Response from security endpoint


Datafield FMT Format

Codetable
Code Text
XML text/xml
JSON application/json

Datafield AUTHTYP Authorization type

Description

Authentication type. See embedded codetable for supported types

Codetable
Code Text
CSRF X-CSRF-TOKEN
OAUTH2 OAuth 2.0
No Authorization
BASIC Basic

Datafield DBGSAV Save Debug Info

Description

When set to non-empty - debug info after API call can be found in stream DBGSTM and saved in debug folder

For the folder - see function SYSTDC.GetVerboseFolder


Datafield REQSAV Save Request

Description

When set to non-empty - request of API call is saved to debug folder.

For the folder - see function SYSTDC.GetVerboseFolder


Datafield RESSAV Save Response

Description

When set to non-empty - response of API call is saved to debug folder.

For the folder - see function SYSTDC.GetVerboseFolder


Datafield CURURL Current URL for calling

Description

Contains current URL.

To get current URL - use GetURI


Datafield PARURL Parameters for URL

Description

Includes parameters of URL

To add parameter - use function AddParToUrl


Datafield FMTREQ Request Content Type

Codetable
Code Text
XML text/xml
JSON application/json
UENC application/x-www-form-urlencoded

Datafield FMTRES Response Content Type

Codetable
Code Text
XML text/xml
JSON application/json

Datafield GNTTYP Grant Type

Codetable
Code Text
No Grant Type
CLICRD client_credentials

Panels

Panel Type Description
AUTHPAN FramePanel Authorization Settings
BASICP FramePanel Authorization Settings - Basic
CSRFP FramePanel Authorization Settings - CSRF
OAUTH2P FramePanel Authorization Settings - OAUTHV2

FramePanel AUTHPAN

Properties
Property Value
Width 788
Height 528
Popup position-X 0
Popup position-Y 0
Visible No
Read only No
Show toolbar No
Instanciated Yes
Popup panel No
Global No

FramePanel BASICP

Properties
Property Value
Width 490
Height 300
Popup position-X 0
Popup position-Y 0
Visible No
Read only No
Show toolbar No
Instanciated No
Popup panel No
Global No

FramePanel CSRFP

Properties
Property Value
Width 490
Height 300
Popup position-X 0
Popup position-Y 0
Visible Yes
Read only No
Show toolbar No
Instanciated No
Popup panel No
Global No

FramePanel OAUTH2P

Properties
Property Value
Width 580
Height 390
Popup position-X 0
Popup position-Y 0
Visible Yes
Read only No
Show toolbar No
Instanciated No
Popup panel No
Global No

Rules

Rule Name Additional
function GetCsrfToken text method
function GetOauth2Token text method
function GetSecurityToken text method
function GetURI text method
sub AddParToUrl method
sub AddToURL method
sub ClearIrrelevantFields method
sub LoadSettings method
sub LoadSettingsCus method
sub SaveSettings method
sub SaveSettingsCus method

Rules Description and Comments

function GetCsrfToken : text method

Gets new X-CSRF security token via given parameters:


function GetOauth2Token : text method

Gets new OAuth 2.0 security token via given parameters:


function GetSecurityToken : text method

Returns security token from the statically defined endpoint

To get security token without endpoint statically configured - use methods:
GetCsrfToken, GetOauth2Token


function GetURI : text method

Returns complete URI of the endpoint including all parameters and added nodes


sub AddParToUrl( in ArgPar text, in ArgVal text ) method

Adds parameter + value to URL for REST API calling

Corresponding functions: RestGet, RestPost, RestPut, RestDelete, AddToURL


sub AddToURL ( in ArgNode text ) method

Adds node to URL

Corresponding functions: RestGet, RestPost, RestPut, RestDelete, AddParToURL


sub LoadSettingsCus method

custom function to extend LoadSettings functionality


sub SaveSettingsCus method

custom function to extend SaveSettings functionality


Modules

Module class Instance Comment
ENCMOD ENCMOD
XMLMOD XMLMOD
SYSTDC SYSTDC
dev/010how/120websrv/0350autmod.txt · Last modified: 2024/04/05 10:10 (external edit)