5.11.2 Implementation of the tag library-based session to obtain user ID
After authentication is completed, the authenticated user ID can be displayed or obtained by using the <ua:getPrincipalName> tag. The following is an example of displaying the user ID.
<%@ taglib uri="http://cosminexus.com/admin/auth/uatags" prefix="ua" %> ... User ID: <ua:getPrincipalName name="lc" /> ...
The above example specifies the LoginContext identifier (lc) that was specified at the time of login as the name attribute of the <ua:getPrincipalName> tag.
The following is an example of obtaining the user ID.
<%@ taglib uri="http://cosminexus.com/admin/auth/uatags" prefix="ua" %> ... <ua:getPrincipalName name="lc" id="userid" />User ID: <%= userid %> ...
The above example specifies the id attribute in addition to the name attribute of the <ua:getPrincipalName> tag. The identifier that identifies the instance referencing the user ID is specified as the id attribute.