This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 145
Authentication Examples
Bhinav Sura edited this page Jul 7, 2017
·
14 revisions
This short screencast demonstrates how to login and logout of Argus using the web interface.
This simple example instantiates an instance of the Argus service and performs a login and logout.
int maxConnections = 10;
ArgusService service = ArgusService.getInstance(
"https://argus.mycompany.com/argusws",
maxConnections);
public void argusLogin(ArgusService service) {
try {
service.getAuthService().login("username", "password");
} catch(IOException e) {
e.printStackTrace();
}
}
This simple example uses curl to perform a login directly against the web services. It stores the obtained tokens in the tokens.out file. Once authenticated, subsequent calls should send the accessToken obtained via the login method as part of the Authorization header.
#!/bin/bash
curl -X POST -H "Content-Type: application/json" \
-d '{"username":"aUsername","password":"aPassword"}' \
https://argus.mycompany.com/argusws/v2/auth/login \
-o tokens.out
# perform some other service operations */
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer <accessToken from tokens.out>" \
-X ....