Skip to content

Authentication⚓︎

You need to log in, yo! Its for everyones safety.

To use the JMP connection with the JNIOR, you must have the proper privileges. You must either be logged in to the correct account or authentication must be disabled. We HIGHLY recommend using proper security best practices. Disabling authentication should only be used for testing and not used in production.

Once the connection has been established the JMP connection will send a "empty" message. It really does not matter what the "empty" message is. The message is sent to solicit an Unauthorized Error message from the JNIOR. That Unauthorized Error message contains a NONCE that will be used in conjuction with the username and password to build a digest for logging in.

The logic in the JmpLib will attempt the provided username and password in the Connection Properties. The default username and password are used unless they are changed by the developer. This is how the username and password can be defined before passing the Connection Properties to the Create Connection function.

1
2
3
4
// define the connection properties for the target jnior
const ipg::connection_properties connection_props = {
    .ip_address = "10.0.0.96", .port = 9222, .username = "username_here", .password = "password_here"
};
1
2
3
4
5
6
// When defining the username and password for theconnection properties, 
// you'll use the .setCredentials function.
var connectionProperties = new ConnectionProperties("10.0.0.96")
SetCredentials("username_here", "password_here");
// If you don't use the setCredentials function call, the username and 
// password used by default is 'jnior', 'jnior'.
1
2
3
4
5
6
// When defining the username and password for theconnection properties, 
// you'll use the .setCredentials function.
ConnectionProperties cp = new ConnectionProperties("10.0.0.96");
cp.setCredentials("username_here", "password_here");
// If you don't use the setCredentials function call, the username and 
// password used by default is 'jnior', 'jnior'.
1
2
3
4
5
6
# When defining the username and password for theconnection properties, 
# you'll use the .set_credentials function.
connection_properties = jmplib_py.ConnectionProperties("10.0.0.96")
.set_credentials("username_here", "password_here")
# If you don't use the set_credentials function call, the username and 
# password used by default is 'jnior', 'jnior'.

Here is an example of an initial authentication exchange at the beginning on a connection.

 --> [10.0.0.62] {"Message":""}
 <-- [10.0.0.62] {"Message":"Error","Nonce":"132adce5b3f4cee0b8540bf502d0","Text":"401 Unauthorized"}
 --> [10.0.0.62] {"Auth-Digest": "jnior:86cc42fc682436d671937e39b0a2517e"}
 <-- [10.0.0.62] {"Administrator":true,"Control":true,"Message":"Authenticated"}

Waiting for the Authentication⚓︎

Version 26.0.0 - May ##, 2026

You can wait for the authentication to either login, or timeout. The waitForAuthentication function call will return the status of the connection at the time of the return.

sequenceDiagram
  autonumber
  Application->>authentication_monitor_object: Wait for authentication
  Note right of Application: Application thread blocks until the<br>authentication is made/fails or the timeout expires
  loop
      authentication_monitor_object->>authentication_monitor_object: 2 second timeout
  end
  JmpConnection-->>authentication_monitor_object: Authenticated / Authentication Failed
  Note right of Application: returns the status of the authentication
  authentication_monitor_object->>Application: <Authentication Status>
  Note right of Application: Application continues...
1
2
3
4
5
6
7
8
9
// wait for the connection to either connect or fail.  this call will
// return the current status of the connection
int connection_result = ipg::wait_for_connection(5);

// we can use the result to get a textual description for the 
// connection state
char* status_description[32];
ipg::get_connection_status_description(const char *uuid, char *status_description);
std::cout << "The connection is " << status_description << std::endl;
1
2
3
// This will wait to proceed further in the code until it resolves 
// the status of the JMP Authentication.
_jmpConnection.WaitForAuthentication();
1
2
3
// This will wait to proceed further in the code until it resolves 
// the status of the JMP Authentication.
jmpConnection.waitForAuthentication();
1
2
3
# This will wait to proceed further in the code until it resolves 
# the status of the JMP Authentication.
jmp_connection.wait_for_authentication()

Authentication Status⚓︎

Version 26.0.0 - May ##, 2026

You can manually check the connection's authentication status by using the Get Authentication Status function.

1
coming soon...
1
2
3
// This will give us a STATUS Code that will represent the state of the 
// authentication.
_jmpConnection.GetAuthenticationStatus()
1
2
3
// This will give us a STATUS Code that will represent the state of the 
// authentication.
jmpConnection.getAuthenticationStatus()
1
2
3
# This will give us a STATUS Code that will represent the state of the 
# authentication.
jmp_connection.get_authentication_status()

Authentication Status Description⚓︎

Version 26.0.0 - May ##, 2026

Alternatively, you can get a string description for state of the connection's authentication by using the Get Authentication Status Description function.

1
coming soon...
1
2
3
// This will give us a STATUS Code that will represent the state of the 
// authentication.
_jmpConnection.GetAuthenticationStatusDescription()
1
2
3
// This will give us a STATUS Code that will represent the state of the 
// authentication.
jmpConnection.getAuthenticationStatusDescription()
1
2
3
# This will give us a STATUS Code that will represent the state of the 
# authentication.
jmp_connection.get_authentication_status_description()

Authentication Callback⚓︎

Version 26.0.0 - May ##, 2026

Optionally, a callback can be assigned that will be alerted when ever there is a change to any of the connection authentication. In order for the callback to be effective, it must be defined before any connections are defined. To define the call back we can do the following...

1
2
3
4
5
6
7
8
9
// Define callback method.  This function will get called when the status of 
// the connections authentication changes
int on_auth_changed(const char *sessionId, const char *status_description) {
    std::cout << std::string(sessionId) + ": " + status_description << std::endl;
    return 0;
}

// Add the callback to the library
ipg::add_on_auth_callback(connection_callback);
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// Defines the callback method that runs when the JMP connection's status 
// changes
private static void AuthenticationStatusChange(string uuid, int statusCode, string statusDescription) {
    Console.WriteLine($"{uuid}: Authentication status is ({statusCode}) {statusDescription}");
}

// Once the AuthenticationStatusChange function is defined, you can
// now add the authentication listener to enable the callback.
// This will check for changes to the JMP authentication, and run the 
// AuthenticationStatusChange function when they occur.
JmpLib.add_authentication_callback(AuthenticationStatusChange);
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
// Defines the callback method that runs when the JMP connection's status 
// changes
@Override
public void onAuthenticationStatusChange(jmpConnection int statusCode, String statusDescription) {
    System.out.println("Authentication Status Code = " + statusCode + ", Authentication Status Description = " + statusDescription);
}

// Once the OnAuthenticationStatusChange function is defined, you can
// now add the authentication listener to enable the callback.
// This will check for changes to the JMP authentication, and run the 
// onAuthenticationStatusChange function when they occur.
JmpLib.addAuthenticationListener(this);
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Defines the callback method that runs when the JMP connection's status 
# changes
def on_authentication_status_change(jmp_connection, status_code: int, status_description: str):
    print(f"Authentication status code: {status_code}. Authentication status description: {status_description}")

# Once the on_authentication_status_change function is defined, you can
# now add the authentication listener to enable the callback.
# This will check for changes to the JMP authentication, and run the 
# on_authentication_status_change function when they occur.
jmplib_py.add_authentication_status_callback(on_authentication_status_change)

Authentication STATUS codes⚓︎

Please go to the Authentication Status Codes section.

dsgf