Skip to content

The LoginTC Java client is a complete LoginTC REST API client to manage LoginTC organizations, users, domains, tokens and to create login sessions.

License

Notifications You must be signed in to change notification settings

logintc/logintc-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

The LoginTC Java client is a complete LoginTC REST API client to manage LoginTC organizations, users, domains, tokens and to create login sessions.

Installation

Compile a JAR using Maven and add it to your build path:

git clone https://github.com/logintc/logintc-java.git
cd logintc-java
mvn install

You can also compile a stand-alone JAR with all dependencies using mvn assembly:single. The compiled JAR files will be located in the target directory.

You can also download prebuilt JARs:

Example

The following example will create an authentication session and wait 60 seconds for the user to approve or deny:

String apiKey = "zoqWOJIeNNsQUPnPtiRjbpb2tm9jV9M1vHCMGImt22SV4lMLvuuIkl4giwRKZcZN";
String domainId = "5340154b751da210542facd75ef8f2a6ba6dc305";

LoginTC client = new LoginTC(apiKey);

Session session = client.createSessionWithUsername(domainId, "john.doe", null);

long time = System.currentTimeMillis();
long timeout = 60 * 1000;

login: while (System.currentTimeMillis() - time < timeout) {
    session = client.getSession(domainId, session.getId());

    switch (session.getState()) {
        case APPROVED:
            System.out.println("Approved!");
            break login;
        case DENIED:
            System.out.println("Denied!");
            break login;
        case PENDING:
        default:
            System.out.println("Waiting...");
            break;
    }

    Thread.sleep(1000L);
}

Documentation

See https://www.logintc.com/docs

Help

Email: [email protected]

https://www.logintc.com

About

The LoginTC Java client is a complete LoginTC REST API client to manage LoginTC organizations, users, domains, tokens and to create login sessions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages