Class AuthCat

java.lang.Object
net.nathcat.authcat.AuthCat

public class AuthCat extends Object

An integration for making requests to the AuthCat service.

This class contains methods which will allow you to easily make requests to the AuthCat service for better integration with your applications.

See Also:
  • Constructor Details

    • AuthCat

      public AuthCat(IHttpProvider httpProvider)
      Create a new AuthCat instance with a custom HTTP provider.
      Parameters:
      httpProvider -
    • AuthCat

      public AuthCat()
      Create a new AuthCat instance using the default HTTP provider (SEHttpProvider).
  • Method Details

    • tryLogin

      public AuthResult tryLogin(org.json.simple.JSONObject authEntry) throws InvalidResponse
      Call the authentication service from AuthCat.
      Parameters:
      authEntry - The supplied authentication data, should contain a username and password field
      Returns:
      The AuthResult
      Throws:
      InvalidResponse - Thrown if the service responds with an unexpected or invalid response code
    • loginWithCookie

      public AuthResult loginWithCookie(String cookie) throws InvalidResponse
      Throws:
      InvalidResponse
    • userSearch

      public org.json.simple.JSONObject userSearch(org.json.simple.JSONObject searchData) throws InvalidResponse
      Call the user search service
      Parameters:
      searchData - The JSON search data, must contain either a username field, or a fullName field, or both
      Returns:
      The JSON response from the server
      Throws:
      InvalidResponse - Thrown if the service responds with an unexpected or invalid response
    • tryAuthenticate

      public AuthResult tryAuthenticate(org.json.simple.JSONObject user)
      Send an authentication request to AuthCat
      Parameters:
      user - The user data
      Returns:
      The AuthResult returned from the authentication request
    • tokenAuth

      public AuthResult tokenAuth(String token) throws org.json.simple.parser.ParseException
      Use a quick auth token for authentication.
      Parameters:
      token - The quick auth token to use
      Returns:
      The AuthResult
      Throws:
      org.json.simple.parser.ParseException
    • createAuthToken

      public String createAuthToken(org.json.simple.JSONObject user) throws org.json.simple.parser.ParseException
      Generate a quick auth token for a user
      Parameters:
      user - The user to generate the quick auth token for
      Returns:
      The quick auth token
      Throws:
      org.json.simple.parser.ParseException