if (session == null) {
log.trace("No session in the current subject context. One will be created to persist principals [{}] " +
"Doing this prevents unnecessary repeated RememberMe operations since an identity has been " +
"discovered.", principals);
//no session - start one:
SessionContext sessionContext = createSessionContext(context);
session = start(sessionContext);
context.setSession(session);
log.debug("Created session with id {} to retain discovered principals {}", session.getId(), principals);
}
bindPrincipalsToSession(principals, session);