@Override
	public String authenticate(UserManager userMgr, Subject subject, Callback[] callbacks)
			throws LoginException {
		GhidraPrincipal principal = GhidraPrincipal.getGhidraPrincipal(subject);
		AtomicReference<String> loginName = new AtomicReference<>();

		try {
			Configuration jaasCfg = getJAASConfig();
			LoginContext loginCtx =
				new LoginContext(loginContextName, null, loginModuleCallbacks -> {
					loginName.set(copyCallbackValues(callbacks, loginModuleCallbacks, principal));
				}, jaasCfg);

			// this is where the callback is triggered
			loginCtx.login();
		}
		catch (IllegalArgumentException e) {
			throw new LoginException("JAAS configuration error: " + e.getMessage());
		}
		catch (LoginException e) {
			// Convert plain LoginExceptions to FailedLoginExceptions to enable
			// the client to retry the login if desired.
			if (e instanceof FailedLoginException) {
				throw e;
			}
			throw new FailedLoginException(e.getMessage());
		}
		finally {
			PasswordCallback srcPcb =
				AuthenticationModule.getFirstCallbackOfType(PasswordCallback.class, callbacks);
			if (srcPcb != null) {
				srcPcb.clearPassword();
			}
		}

		String loginNameResult = loginName.get();
		return (loginNameResult != null) ? loginNameResult : principal.getName();
	}
Creates a new {@link JAASAuthenticationModule} instance.

@param loginContextName the name of the configuration entry from the JAAS config to use
@param allowUserToSpecifyName flag, if true will include a {@link NameCallback} in the
{@link #getAuthenticationCallbacks()} list, which allows the user to specify a different
name than their {@link GhidraPrincipal}.
@param jaasConfigFile JAAS config file
@throws IllegalArgumentException if the loginContextName is not present in the JAAS configuration or
if the JAAS config file does not exist
Ghidra/Features/GhidraServer/src/main/java/ghidra/server/security/JAASAuthenticationModule.java