Set the Credential Expiration
Once we have the Credential object, we need only create an XMLGregorianCalendar corresponding to the desired end date.
//Create a gregorian calendar with the current date and time
GregorianCalendar calendar = new GregorianCalendar();
//Add the offset that corresponds to when the session should expire
calendar.add(durationUnits, duration);
//Create a new XMLGregorianCalendar based on our GregorianCalendar
XMLGregorianCalendar expiration = datatypeFactory.newXMLGregorianCalendar(calendar);
//set that as the expiration date
currentCredential.setExpiration(expiration);
//persist the changes
port.editCredential(currentCredential, sessionId);
Last modified date: 12/17/2021