No Results
Custom Credential Types

Many applications use simple username/password authentication, which is modeled by the built-in UserPass credential type.  The other built-in type is UserDomainPass, which is intended to cover the requirements of NTLM authentication.  UserDomainPass could easily be used for other authentication methods, by overloading the domain field to be ‘organization’ or ‘department’ for example, but in these situations, it is recommended to define specific credential types.  This eases the EdgeCore administration workflow in larger and more complex environments, as drop-down selections are able to be restricted to only those credential values that are relevant in the context they are being configured.

A simple example follows.  We have an application that requires a username, department, and password for authentication.

This appdef snippet defines the credential type.  Note that the credentialsType value is a field of AppDefDO.  Note also how the versionDef’s credentialsType field references the id value of the custom credential type.

"credentialTemplates": [
  {
    "doClass": "CredentialTemplateDO",
    "id": "UserDeptPass",
    "name": "Username, Department, and Password",
    "credentialFields": [
      {
        "doClass": "CredentialDefFieldDO",
        "key": "Username",
        "isPassword": false,
        "isRequired": true
      },
      {
        "doClass": "CredentialDefFieldDO",
        "key": "Department",
        "isPassword": false,
        "isRequired": true
      },
      {
        "doClass": "CredentialDefFieldDO",
        "key": "Password",
        "isPassword": false,
        "isRequired": true
      }
    ]
  }
],
 
 
"versionDefs": [
  {
    "doClass": "AppVersionDefDO",
    "version": "1.1",
    "destination": "http://change_me",
    "ssoHandler": "MyAppSso",
    "credentialsType": "UserDeptPass",
    "rules": [
      "MyApp"
    ],
    "feedTypeNames": [
      "MyAppBase",
      "GenericWebContentFeed"
    ],
    "defaultFeedTypeName": "MyAppBase"
  }
]

The SSO rule snippet below shows how a value of the custom credential type is accessed.

this.makeLoginPostRequest = function(ctx) {
    if (ctx.ssoCredentials) {
        ctx.startSsoRequest("POST", "/MyApp/Admin/login/login.aspx",
            function onLoginPostResponseWrapper(ctx) { self.onLoginPostResponse(ctx); });
 
        ctx.appRequest.setContentType("application/x-www-form-urlencoded");
        // NB credential field names are lowercased before being inserted into ctx.ssoCredentials map
        ctx.appRequest.addFormParameter('username', ctx.ssoCredentials.get('username'));
        ctx.appRequest.addFormParameter('department', ctx.ssoCredentials.get('department'));
        ctx.appRequest.addFormParameter('password', ctx.ssoCredentials.get('password'));
    }
};

 


Terms | Privacy