Appendix I - Java 17 upgrade and changes introduced with 7.2311.0.x
Together with Java 17 upgrade, a major cleanup was done in multiple places including the update of most dependencies. This appendix will guide you through the changes.
It is recommended to recompile custom Java auth states, REST or SOAP services using Java 17 and nevisAuth artifacts version 7.2311.x. As all of those are likely to become incompatible.
Note, that recompilation does not warrant that everything will work fine. Even if the build is successful, runtime issues can still arise. Therefore, thorough testing of any custom development is recommended.
Nevis does not recommend and will not provide support for using Java 8 compiled custom Java auth states, REST or SOAP services in nevisAuth version 7.2311.x.
nevisAuth API changes
The following chapter summarizes the changes in the nevisAuth SDK.
The following list does not contain every change made in the internal artifact nevisauth-core or other modules.
Date handling
Java 8 introduced a new java.time API which replaces the old legacy API (java.util.Date, java.utils.Calendar and more)
The community and industry seems to be lagging behind with introducing the new java.time API. This is caused by Java API itself using the legacy date API in core places, because it is very difficult to replace.
Third party libraries used by nevisAuth start to use the java.time API more and more. Therefore, Nevis also moved on to use the java.time API. This causes breaking changes in multiple places of the nevisAuth API.
As the date handling is quite complex, the separate Date Handling Changes guide you through the changes there.
OOCD
Changes in the OOCD interface because of the date handling and removing deprecated API & features. For more see OOCD Changes.
Session
| Where | Old | Replacement |
|---|---|---|
NevisSession | getAttributeNames | getAttributeNamesIterator |
NevisSession | acquireReadOnly | ❌ |
NevisSession | acquireReadWrite | - (moved to Session) |
NevisSession | release | - (moved to Session) |
NevisSession | Object getData(); | Map<String, String> getData(); |
NevisSession | Object getAttribute(String name); | String getAttribute(String name); |
NevisSession | void setAttribute(String name, Object value); | void setAttribute(String name, String value); |
Session | isInitial | isAuthentic Note it is the inverse! |
Session | getDomainMappings | ❌ |
Session | setDomainMappings | ❌ |
ScriptState | Map<?,?> session | Map<String,String> session |
ScriptStates
The change that the Session attributes are only accepting String has a special caveat in Groovy scripts.
Groovy itself does not enforce types strictly on a Map object; thus in a groovy script, you can actually set a non String object in a String typed Map. This behaviour causes a ClassCastException in nevisAuth when the Session is accessed from the Java code.
To mitigate this the ScriptState will check the session attributes for any non String values and throw an exception with the name of the keys and types.
A special case of this is when a org.codehaus.groovy.runtime.GStringImpl type is added as a Session attribute. This happens when using an expression inside double quotes. Example: session.put("outarg.$name", value) working replacement: session.put('outarg.' + name, value).
Below is an example of how to convert non String objects to JSON to store it in the session. Based on our experience, the most typical case is when a script try to store a Map object in the session. In some cases a simple concatenation could also work - but using the JSON utilities from Groovy reduces the chance of an error. (You don't have to worry about escaping.) As serialisation is a complex topic, this approach might not work with more complex Java types.
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def originalMap = [
key1: 'value1',
key2: 'value2'
]
session.put('test', JsonOutput.toJson(originalMap));
def restoredMap = new JsonSlurper().parseText(session['test'])
In previous versions nevisAuth did not store non String session attributes in the remote session store. When migrating to store session attributes in String format in your scripts, mind that now nevisAuth also stores those in the database. In case you just temporarily stored some objects in the session and relied on the remote session store to throw them away, now you have to take care of removing those from the session yourself. (If those are not to be stored in the session on the long term.)
AuthEngine / AuthState general
| Where | Old | Replacement |
|---|---|---|
AuthConst | DEFAULT_TRANSITION | DEFAULT_RESULT |
AuthConst | LAST_TRANSITION | LAST_RESULT |
AuthConst | LAST_STATE | CURRENT_STATE |
AuthConst | INVALID_INPUT | AUTH_FAILED |
AuthConst | NEVIS_AUTH_GUI | ❌ |
AuthState | isInitialDispatcher | ❌ |
AuthState | getAttribute | getMandatoryAttribute or getOptionalAttribute |
AuthState | convertListDescriptor | getListAttribute |
AuthState | getHttpHeaderFromRequest | request.getHttpHeader |
AuthState | getTransition | getTransition with AuthRequest and AuthResponse parameters |
AuthTransition | getName | getTriggeringCondition |
AuthTransition | getState | getTargetState |
AuthRequest | getDomainMapping | ❌ |
AuthRequest | getDomainMappings | ❌ |
AuthResponse | setDomainMappings | ❌ |
AuthResponse | addDomainMapping | ❌ |
Auditable | getDomainMappings | ❌ |
EL expression | addDomainMapping | ❌ |
Utilities
| Old | Replacement |
|---|---|
CommandStarter, CommandWaiter, StreamConnector | CommandExecutor |
deprecated encryptWhereNeccessary method in the Communicator, Encrypter | encryptWhereNeccessary with additional arguments |
AuthSSLContextFactory | ❌ |
AuthSSLX509TrustManager | ❌ |
Command line utilities in jcan-saml | ❌ |
SAML Assertion / Response generation signing in jcan-saml | Use OpenSaml 4. |
jcan-saml-tools.jar | ❌ |
Command line utilities in jcan-sectoken | ❌ |
Deprecated methods in jcan-sectoken | ❌ |
OpTracing
Implementation
The old library jcan-optrace relies on the javax.servlet API, therefore it is not compatible with the new Java 17 nevisAuth release.
As Nevis does not have the source of this library the jcan.Op OpTrace logs will be replaced by using OpenTelemetry Java agent.