Mi-Token API Interface Specification
Mi-Token API Interface Specification
Interface Specification
In this case the client should get another challenge and use it to obtain new session (as
described above), then retry the API call which failed. This should be performed by the low
level API client code so that the component using the API client is shielded from the security
related activities.
The requirement to have sessions can be turned off using a Registry setting. This is not
recommended unless there is an alternative security arrangement, for instance a firewall on
the API Service server restricting callers to a whitelisted set of API clients with firewalls on
the API client machines optionally further restricting the ability to make outbound calls to a
known process hosting the API client.
2.1 GetChallenge
The API returns a random challenge. The challenge should be hashed and the hash value
used to call the NewSession API. See section 1.3 for further information.
Request URL:
https://<address>/mi-token/api/authentication/v4/RawHttpWithSSL/getchallenge
Request Method: GET
Request version: HTTP/1.1
Response content type: text/plain
Response content: { 'result' : <result>, 'details' : <challenge> }
<result> : 'success'
<challenge> : 32-byte random challenge encoded as Base64 string.
Sample Output:
{ "result" : "success",
"details" : "LloSgmkp1KDbllkgeWGwZXLDSTuarafaEV1wf2o/0AY=" }
2.2 NewSession
The API is used to present the calculated hash of the challenge returned by the
GetChallenge API and obtain a session ID.
Request URL:
https://<address>/mi-token/api/authentication/v4/RawHttpWithSSL/newsession
Request Method: POST
Request version: HTTP/1.1
Request content type: application/x-www-form-urlencoded
Posted form variable:
response: <hash>
Response content type: text/plain
Response content: { 'result' : <result>, 'details' : <details> }
<result> : 'success' | 'error'
return response;
}
Sample Outputs:
{ "result" : "success",
"details" : "HABajHr82T0W8g4hjwQ7VR/mRxy7wsTISncs6G7eD9M=" }
Note: The session ID returned by this API is valid for 15 minutes and should be supplied as
the ‘session’ variable while making all the API calls mentioned later in this document. This
requirement is mentioned in the specification of each subsequent API. When the session ID
expires, all the subsequent APIs return HTTP status code 403 (see section 1.3) and this is not
mentioned in the API specifications.
2.3 VerifyOtp
The API is used to verify one time password (OTP) for a given username. All the hard-tokens
and soft-tokens assigned to the user will be tried in an attempt to find a match. If the OTP
matches then the token-id of the token which produced the matching OTP is returned. If the
OTP doesn’t match the user is rejected with 'result' set to 'failure'.
Sample Outputs:
{ "result" : "success", "details": {"token":"ccccbgbujild"} }
{ "result" : "failure",
"details" : "user has no tokens assigned (UserID Mode)" }
2.4 AssignToken
Assign hard-token token-id to user user-name.
Sample Outputs:
{ "result" : "success", "details" : "1 token assigned" }
{ "result" : "error",
"details" : "Both the username and token variables are required." }
2.5 UnassignToken
Unassign token token-id.
Request URL:
https://<address>/mi-token/api/authentication/v4/RawHttpWithSSL/unassign
Request Method: POST
Request version: HTTP/1.1
Request content type: application/x-www-form-urlencoded
Posted form variables:
token: <token-id>
session: <session ID>
Response content type: text/plain
Response content: { 'result' : <result>, 'details' : <details> }
<result> : 'success' | 'failure' | 'unauthorized' | 'error' | 'exception'
Sample Outputs:
{ "result" : "success", "details" : "1 token unassigned" }
2.6 EnableToken
Enable token token-id.
Sample Outputs:
{ "result" : "success", "details" : "1 token enabled" }
2.7 DisableToken
Disable token token-id.
Sample Outputs:
{ "result" : "success", "details" : "1 token disabled" }
2.8 CreateSoftToken
Create a soft-token for user user-name and return the token activation URL.
Request URL:
https://<address>/mi-token/api/authentication/v4/RawHttpWithSSL/createsofttoken
Sample Outputs:
{ "result" : "success",
"details" : {"tokenSerial" : "0a380965-eb70-471c-8c6d-c9bc41d36920",
"tokenLink" : "https://mobile.mi-token.com/4/i/demo/WI20JP
JfpbquvOmKDIqWwXmGgUNakf2C8PVSfgYWzbm19Nk5F4vZzjxVbcviA9W3"} }
{ "result" : "error",
"details" : "loadingCode is not specified, or is of the wrong length." }
2.9 DeleteToken
Delete token token-id.
Request URL:
https://<address>/mi-token/api/authentication/v4/RawHttpWithSSL/delete
Request Method: POST
Request version: HTTP/1.1
Request content type: application/x-www-form-urlencoded
Posted form variables:
token: <token-id>
session: <session ID>
Response content type: text/plain
Response content: { 'result' : <result>, 'details' : <details> }
Sample Outputs:
{ "result" : "success", "details" : "1 token deleted" }
{ "result" : "error",
"details" : "The token variable is required." }
2.10 ListUserTokens
List all soft-tokens and hard-tokens assigned to a user user-name.
Sample Outputs:
{ "result" : "success", "details" : [], "count" : 0 }
{ "result" : "success",
"details" : [{"tokenName":"HOTP YubiKey 285640", "tokenSerial":"285640"},
{"tokenName":"YubiKey 285457", "tokenSerial":" ccccbgbujild"},
{"tokenName":"Token MT0100011026", "tokenSerial":MT0100011026"},
{"tokenName":"Mobile Soft Token d3e725a5-8898-4ec2-87e0-
b6153ea65692","tokenSerial":"d3e725a5-8898-4ec2-87e0-
b6153ea65692"}],
"count" : 4 }
2.11 ListUnassignedHardtokens
List all unassigned hard-tokens imported into the system.
Request URL:
https://<address>/mi-token/api/authentication/v4/RawHttpWithSSL/listunassigned
Request Method: POST
Request version: HTTP/1.1
Request content type: application/x-www-form-urlencoded
Posted form variables:
format: “nameserial”
session: <session ID>
Response content type: text/plain
Response content: { 'result' : <result>, 'details' : <details> }
<result> : 'success' | 'unauthorized' | 'error' | 'exception'
Sample Outputs:
{ "result" : "success", "details" : [], "count" : 0 }
{ "result" : "success",
"details" : [{"tokenName":"HOTP YubiKey 285640", "tokenSerial":"285640"},
{"tokenName":"YubiKey 285457", "tokenSerial":" ccccbgbujild"},
{"tokenName":"Token MT0100011026", "tokenSerial":MT0100011026"}],
"count" : 3 }
2.12 DeleteUnassignedSoftTokens
Delete all unassigned soft-tokens.
Request URL:
https://<address>/mi-token/api/authentication/v4/RawHttpWithSSL/deleteunassigned
Request Method: POST
Request version: HTTP/1.1
Request content type: application/x-www-form-urlencoded
Posted form variables:
session: <session ID>
Response content type: text/plain
Response content: { 'result' : <result>, 'details' : <details> }
<result> : 'success' | 'unauthorized' | 'exception'
<details> : <message>
2.13 DeleteUser
Delete all soft-tokens and unassign all hard-tokens assigned to user user-name.
Request URL:
https://<address>/mi-token/api/authentication/v4/RawHttpWithSSL/deleteuser
Request Method: POST
Request version: HTTP/1.1
Request content type: application/x-www-form-urlencoded
Posted form variables:
username: <username>
usertype: “raw”
session: <session ID>
Response content type: text/plain
Response content: { 'result' : <result>, 'details' : <details> }
<details> : <message>
Sample Outputs:
{ "result" : "success", "details" : "user tokens processed" }