private String getAuthenticationIdAttribute(String attributeName, HttpContext context)
     throws InternalServerErrorException {
   try {
     return (String) context.getAttributes().get(attributeName);
   } catch (final ClassCastException e) {
     throw new InternalServerErrorException(
         "The security context could not be created because the "
             + "authentication ID attribute, "
             + attributeName
             + ", contained in the HTTP request did not have "
             + "the correct type",
         e);
   }
 }
 @SuppressWarnings("unchecked")
 private Map<String, Object> getAuthorizationIdAttribute(String attributeName, HttpContext context)
     throws InternalServerErrorException {
   try {
     return (Map<String, Object>) context.getAttributes().get(attributeName);
   } catch (final ClassCastException e) {
     throw new InternalServerErrorException(
         "The security context could not be created because the "
             + "authorization ID attribute, "
             + attributeName
             + ", contained in the HTTP request did not have "
             + "the correct type",
         e);
   }
 }