OpenCCT: OpenID Connect SSO authentication client Java library - Page 6
Retrieving authenticated user's data

The processing to be carried out after the return of authentication information by the server must make it possible to check whether the current user is authenticated or not. If the user is authenticated, it must be possible to obtain his recovered data. To do this, use a code, in the target application, like this one:

User loggedUser = (User)session.getAttribute(AuthParameters.LOGGEDUSER); // session is the current instance of HttpSession
String userID = "";
if (loggedUser == null) {
// User isn't authenticated
} else userID = loggedUser.getUid(); // to obtain user ID

This code example should be used in the appropriate place (s) of the target application's code to verify authentication or retrieve user's data.