Domains

A domain object represents a service (e.g. VPN or website) and contains a collection of user and token unlocking policies (e.g. key, passcode, minimum lengths). A domain id consists of a unique 40-character hexadecimal unique identifier.

Resources

PUT /domains/{domainId}/users/{userId}

Add a user to a domain.

Example

curl -X PUT https://cloud.logintc.com/api/domains/9120580e94f134cb7c9f27cd1e43dbc82980e152/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38 \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"' \
  -H 'Content-Length: 0'
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Domain id
$domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152';

// User id
$user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38';

// Helper function to add user to domain
$logintc->addDomainUser($domain_id, $user_id);
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# Domain id
domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152'

# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'

# Helper function to add user to domain
client.add_domain_user(domain_id, user_id)
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // Domain id
    String domainId = "9120580e94f134cb7c9f27cd1e43dbc82980e152";
 
    // User id
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

    // Helper function to add user to domain
    logintc.addDomainUser(domainId, userId);
  }
}

PUT /domains/{domainId}/users

Synchronize domain users with specified users.

Parameters

Name Description Required
username A 1 to 128-character unique identifier Yes
name A 1 to 128-character real name (can be the same as username) Yes
email The user’s valid email address Yes

All users who are currently in the domain but do not appear in the body will be removed and their tokens will be revoked. All new users in the body will be created if they do not yet exist.

Example

$ curl -X PUT https://cloud.logintc.com/api/domains/9120580e94f134cb7c9f27cd1e43dbc82980e152/users \
  -d '[{"username" : "user1", "name" : "user1", "email" : "user1@example.com"}, {"username" : "user2", "name" : "user2", "email" : "user2@example.com"}]' \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Domain id
$domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152';

// User details
$user1 = new User('user1', 'user1', 'user1@example.com');
$user2 = new User('user2', 'user2', 'user2@example.com');

$users = array($user1, $user2);

// Helper function to sync domain users
$logintc->setDomainUsers($domain_id, $users);
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# Domain id
domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152'

# User details
users = [{'username' : 'user1',
          'email' : 'user1@example.com',
          'name' : 'user1'},
         {'username' : 'user2',
          'email' : 'user2@example.com',
          'name' : 'user2'}]

# Helper function to sync domain users
client.set_domain_users(domain_id, users)
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.User;

import java.util.Arrays;
import java.util.List;

public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // Domain id
    String domainId = "9120580e94f134cb7c9f27cd1e43dbc82980e152";
 
    // User details
    User user1 = new User("user1", "user1@example.com", "user1");
    User user2 = new User("user2", "user2@example.com", "user2");
        
    List<User> users = Arrays.asList(user1, user2);

    // Helper function to sync domain users
    logintc.setDomainUsers(domainId, users);
  }
}

DELETE /domains/{domainId}/users/{userId}

Remove a user from a domain.

Removing a user from the domain revokes their token and any pending confirmation codes.

Example

$ curl -X DELETE https://cloud.logintc.com/api/domains/9120580e94f134cb7c9f27cd1e43dbc82980e152/users/8c184f495a5b7b6e9ed732f2ce3c67e310806f38 \
  -H 'Authorization: LoginTC key="YOUR_API_KEY"'
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Domain id
$domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152';

// User id
$user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38';

// Helper function to remove user from domain
$logintc->removeDomainUser($domain_id, $user_id);
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# Domain id
domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152'

# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'

# Helper function to remove user from domain
client.remove_domain_user(domain_id, user_id)
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException {
    LoginTC logintc = new LoginTC(API_KEY);

    // Domain id
    String domainId = "9120580e94f134cb7c9f27cd1e43dbc82980e152";
 
    // User id
    String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";

    // Helper function to remove user from domain
    logintc.removeDomainUser(domainId, userId);
  }
}

GET /domains/{domainId}

Get information about a domain: id, name, type, and keyType.

Example

$ curl -X GET https://cloud.logintc.com/api/domains/ab3e96cfdf3c6994ebe9062e0094c07f67872f10 -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "id":"ab3e96cfdf3c6994ebe9062e0094c07f67872f10",
    "name":"Cisco ASA",
    "type":"RADIUS",
    "keyType":"PIN"
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

//Domain id
$domain_id = 'ab3e96cfdf3c6994ebe9062e0094c07f67872f10';

// Helper function to get domain
$domain = $logintc->getDomain($domain_id);

echo $domain->getName();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# Domain id
domain_id = 'ab3e96cfdf3c6994ebe9062e0094c07f67872f10'

# Helper function to get domain
domain = client.get_domain(domain_id)

print domain['name']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.Domain;

public class Example {

    // Your API Key from cloud.logintc.com/panel/settings
    public static final String API_KEY = "YOUR_API_KEY";

    public static void main(String[] args) throws LoginTCException {
        LoginTC logintc = new LoginTC(API_KEY);

        // Domain id
        String domainId = "ab3e96cfdf3c6994ebe9062e0094c07f67872f10";

        // Helper function to get domain
        Domain domain = logintc.getDomain(domainId);

        System.out.println(domain.getName());

    }
}

GET /domains/{domainId}/image

Get your domain image.

Example

$ curl -X GET https://cloud.logintc.com/api/domains/ab3e96cfdf3c6994ebe9062e0094c07f67872f10/image -H 'Authorization: LoginTC key="YOUR_API_KEY"'
Image returned as raw binary with `image/png` type
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

//Domain id
$domain_id = 'ab3e96cfdf3c6994ebe9062e0094c07f67872f10';

// Helper function to get domain image
$image = $logintc->getDomainImage($domain_id);

// Creates a file with your image
file_put_contents('domain-image.png', $image);
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# Domain id
domain_id = 'ab3e96cfdf3c6994ebe9062e0094c07f67872f10'

# Helper function to get domain image
domain_image = client.get_domain_image(domain_id)

# Open file to save image to
f = open('domain-image.png', 'wb')

# Write image to file
f.write(domain_image)
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
 
public class Example { 
 
  // Your API Key from cloud.logintc.com/panel/settings
  public static final String API_KEY = "YOUR_API_KEY";
 
  public static void main(String[] args) throws LoginTCException, IOException {
    LoginTC logintc = new LoginTC(API_KEY);

    // Domain id
    String domainId = "ab3e96cfdf3c6994ebe9062e0094c07f67872f10";
 
    // Helper function to get domain image
    byte[] image = logintc.getDomainImage(domainId);
    
    //Write image to file
    FileOutputStream output = new FileOutputStream(new File("domain-image.png"));
    output.write(image);

  }
}

GET /domains/{domainId}/users/{userId}

Get information about a domain user: username, name, email and domain memberships

Example

curl -X GET https://cloud.logintc.com/api/domains/ab3e96cfdf3c6994ebe9062e0094c07f67872f10/users/f2904752f8394dfe1b6485969e5c1677655d1511 -H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
    "id":"f2904752f8394dfe1b6485969e5c1677655d1511",
    "username":"jsmith21",
    "name":"John Smith",
    "email":"jsmith@email.com",
    "domains":["ab3e96cfdf3c6994ebe9062e0094c07f67872f10"]
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Domain id
$domain_id = 'ab3e96cfdf3c6994ebe9062e0094c07f67872f10';

// User id
$user_id = 'f2904752f8394dfe1b6485969e5c1677655d1511';

// Helper function to get domain user
$user = $logintc->getDomainUser($domain_id, $user_id);

echo $user->getName();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# Domain id
domain_id = 'ab3e96cfdf3c6994ebe9062e0094c07f67872f10'

# User id
user_id = 'f2904752f8394dfe1b6485969e5c1677655d1511'

# Helper function to get domain user
user = client.get_domain_user(domain_id, user_id)

print user['name']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.User;

public class Example {

    // Your API Key from cloud.logintc.com/panel/settings
    public static final String API_KEY = "YOUR_API_KEY";

    public static void main(String[] args) throws LoginTCException {
        LoginTC logintc = new LoginTC(API_KEY);

        // Domain id
        String domainId = "ab3e96cfdf3c6994ebe9062e0094c07f67872f10";

        // User id
        String userId = "f2904752f8394dfe1b6485969e5c1677655d1511";

        // Helper function to get domain user
        User user = logintc.getDomainUser(domainId, userId);

        System.out.println(user.getName());

    }
}

GET /domains/{domainId}/users

Get information about all the users in a domain: List of domain users

Example

curl -X GET https://cloud.logintc.com/api/domains/ab3e96cfdf3c6994ebe9062e0094c07f67872f10/users -H 'Authorization: LoginTC key="YOUR_API_KEY"'
[
    {
        "id":"1d046436bd58a6c824b8e6b4ee1ba0c34c7c0d1e",
        "username":"dmatute",
        "name":"Diego",
        "email":"dmatute@cyphercor.com",
        "domains":["ab3e96cfdf3c6994ebe9062e0094c07f67872f10"]
    },
    {
        "id":"469986591e4c4329a73b0bdf432698c6d96b4030",
        "username":"jdoe2",
        "name":"Jane Doe",
        "email":"jdoe@email.com",
        "domains":["ab3e96cfdf3c6994ebe9062e0094c07f67872f10"]
    },
    {
        "id":"b567ba1f3f7815439c3de922890600b88a480e32",
        "username":"jsmith2",
        "name":"John Smith",
        "email":"jsmith@email.com",
        "domains":["ab3e96cfdf3c6994ebe9062e0094c07f67872f10"]
    },
    {
        "id":"f2904752f8394dfe1b6485969e5c1677655d1511",
        "username":"jsmith21",
        "name":"John Smith",
        "email":"jsmith@email.com",
        "domains":["ab3e96cfdf3c6994ebe9062e0094c07f67872f10"]
    }
]
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');

// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);

// Domain id
$domain_id = 'ab3e96cfdf3c6994ebe9062e0094c07f67872f10';

// Helper function to get domain users
$users = $logintc->getDomainUsers($domain_id);

echo array_values($users)[0]->getName();
# Get the library from github.com/logintc/logintc-python
import logintc

# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)

# Domain id
domain_id = 'ab3e96cfdf3c6994ebe9062e0094c07f67872f10'


# Helper function to get domain users
users = client.get_domain_users(domain_id)

print users
import java.util.List;

// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.User;

public class Example {

    // Your API Key from cloud.logintc.com/panel/settings
    public static final String API_KEY = "YOUR_API_KEY";

    public static void main(String[] args) throws LoginTCException {
        LoginTC logintc = new LoginTC(API_KEY);

        // Domain id
        String domainId = "ab3e96cfdf3c6994ebe9062e0094c07f67872f10";

        // Helper function to get domain users
        List users = logintc.getDomainUsers(domainId);

        System.out.println(users.get(0).getName());

    }
}