protected SAMLSubject getSamlSubject(final Authentication authentication) throws SAMLException {
    final SAMLSubject samlSubject = new SAMLSubject();
    samlSubject.addConfirmationMethod(SAMLSubject.CONF_ARTIFACT);
    final SAMLNameIdentifier samlNameIdentifier = new SAMLNameIdentifier();
    samlNameIdentifier.setName(authentication.getPrincipal().getId());

    samlSubject.setNameIdentifier(samlNameIdentifier);

    return samlSubject;
  }