/**
   * Determine if given Role is contained within User's Tomcat Principal object. This method does
   * not need to hit the ldap server as the User's activated Roles are loaded into {@link
   * org.apache.directory.fortress.realm.TcPrincipal#setContext(java.util.HashMap)}
   *
   * @param principal Contains User's Tomcat RBAC Session data that includes activated Roles.
   * @param role Maps to {@code org.apache.directory.fortress.core.model.Role#name}.
   * @return True if Role is found in TcPrincipal, false otherwise.
   */
  @Override
  public boolean hasRole(Wrapper wrapper, Principal principal, String role) {
    if (realm == null) {
      throw new IllegalArgumentException(
          CLS_NM
              + "authenticate detected Fortress Tomcat7 Realm not initialized correctly.  Check your Fortress Realm configuration");
    }

    return realm.hasRole(principal, role);
  }