Package com.googlecode.fascinator.common

Examples of com.googlecode.fascinator.common.JsonSimple


      if(Velocity.getProperty(Velocity.FILE_RESOURCE_LOADER_PATH) != null) {
          logger.debug(String.format("Resource Loader Path: %s", Velocity.getProperty(Velocity.FILE_RESOURCE_LOADER_PATH).toString()));
          template = Velocity.getTemplate("rapidaaf/interface.vm");
        }
          JsonSimpleConfig config = new JsonSimpleConfig();
          ssoConfig = new JsonSimple(config.getObject(ID));
         
          rapidAafUrl = ssoConfig.getString("", "url");
          attrParentField = ssoConfig.getString("", "attrParentField");
          usernameField = ssoConfig.getString("", "usernameField");
          source = ssoConfig.getString("", "source");
View Full Code Here


  @Override
  public User getUserObject(JsonSessionState session) {
    RapidAafUser user = (RapidAafUser) session.get("jwt_user");
    long now = new Date().getTime() / 1000;
    if (user == null) {
      JsonSimple jwt_json =  (JsonSimple) session.get("jwt_json");
      Integer jwt_exp = (Integer) session.get("jwt_exp");
      if (jwt_json == null || jwt_exp == null) {
        logger.error("Session does not have jwt_json or jwt_exp, might be expired.");
        return null;         
      }     
      if (now > jwt_exp.longValue()) {
        logger.error("Session has expired, exp: " + jwt_exp + ", now:" + now);
        return null;
      }   
      String username = jwt_json.getString(null, attrParentField, usernameField);
      if (username == null) {
        logger.error("JWT has no username attribute: "+attrParentField + "->" + usernameField);
        return null;
      }
      String realName = jwt_json.getString(username, attrParentField, "displayname");
      user = new RapidAafUser(realName);
      // set the attributes...
      user.setUsername(username);     
      user.set("jti", jwt_json.getString("", "jti"));
      user.set("exp", jwt_exp.toString());
      List<String> userFieldNames = ssoConfig.getStringList("userFields");
      for (String userFieldName : userFieldNames) {
        String fieldVal = jwt_json.getString(null,  attrParentField, userFieldName);
        if (fieldVal != null) {
          logger.debug("Setting '"+userFieldName+"' with value: " + fieldVal);
          user.set(userFieldName, fieldVal);         
        } else {
          logger.debug("Skipping setting of " + userFieldName + ", null value.");
View Full Code Here

TOP

Related Classes of com.googlecode.fascinator.common.JsonSimple

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.