This tutorial guides you through the process of building a sample application using the REST API. The goals for the tutorial are to gain competence and familiarity with the process of developing a DualShield application.This tutorial uses Python as the programming language. It assumes:
- You have installed DualShield platform.
- You can write, test, and troubleshoot a Python application.
Building a DualShield API application is actually quite simple. There are only 3 basic steps:
- Register an API Agent
- Download the Agent Certificate
- Write your codes
...
Table of Contents | ||
---|---|---|
|
...
Register an API Agent
To DualShield, your application is an API agent. Therefore, the very first step is to register your application as an API Agent in the DualShield authentication server.
To register an agent, you must first create the following objects in DualShield:
- A domain
- A realm
- A logon procedure
- An application
The type of the logon procedure should be set as "Web SSO"
And the logon procedure does not have to contain any logon steps.
...
As mentioned, the communication protocol between your application and the DualShield is always HTTPS. Therefore you need to download the agent's certificate which will be required in your application codes.
You can use either PKCS12 or PEM certificate in your code.
...
Expand | ||||||
---|---|---|---|---|---|---|
|
Download the API Agent Certificate
Expand | ||||||
---|---|---|---|---|---|---|
|
Write an API Application
Test API in Python
Expand | ||||||
---|---|---|---|---|---|---|
|
Test API in Postman
Expand | ||||||
---|---|---|---|---|---|---|
|
- Rename "My application.pem" to "apicert.pem"
- In the CMD console, execute:
...
host = 'dualshield.deepnetlabs.com' |
...
Call the"Hello" method in DualShieldto check the connection
Code Block | ||
---|---|---|
| ||
def test_1_hello(self):
r=self.auth.execute("auth/hello", {})
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e9129c09-948c-45d8-be42-50c5ca2ba70c"><ac:plain-text-body>
<![CDATA[ self.assertEqual(r['error'], 0)
]]></ac:plain-text-body></ac:structured-macro>
|
...
The authentication method for verifying Static Password is "SPASS"
def test_2_staticpass(self): | ]]></ac:plain-text-body></ac:structured-macro> |
...
The authentication method for verifying Static Password is "OTP"
def test_3_verifySafeID(self): | ]]></ac:plain-text-body></ac:structured-macro> |
...
To deliver an on-demand password to a user via email message (SMTP)
def test_4_sendOTP(self): | ]]></ac:plain-text-body></ac:structured-macro> |
...
The authentication method for verifying On-Demand Password is "OTPoD"
def test_5_verifyODP(self): | ]]></ac:plain-text-body></ac:structured-macro> |
...