/**
   * Logout the provided user
   *
   * @return user The user to logout
   */
  @Override
  public void logout(JsonSessionState session, User user) throws AuthenticationException {
    String source = user.getSource();

    // Clear session
    session.remove("username");
    session.remove("source");

    // SSO Users
    if (sso.containsKey(source)) {
      sso.get(source).logout(session);
      return;
    }

    // Trust token users
    if (source.startsWith(TRUST_TOKEN_PREFIX)) {
      session.remove("validToken");
      return;
    }

    // Standard users
    authManager.logOut(user);
  }
  /**
   * Get the list of roles possessed by the current user.
   *
   * @param user The user object of the current user
   * @return String[] A list of roles
   */
  @Override
  public String[] getRolesList(JsonSessionState session, User user) {
    String source = user.getSource();
    List<String> ssoRoles = new ArrayList();

    // SSO Users
    if (sso.containsKey(source)) {
      ssoRoles = sso.get(source).getRolesList(session);
    }

    // Standard Users
    GenericUser gUser = (GenericUser) user;
    String[] standardRoles = roleManager.getRoles(gUser.getUsername());
    for (String role : standardRoles) {
      // Merge the two
      if (!ssoRoles.contains(role)) {
        ssoRoles.add(role);
      }
    }

    // Cast to array and return
    return ssoRoles.toArray(standardRoles);
  }