com.networknt.config.Config.getJsonMapConfig()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(11.3k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中com.networknt.config.Config.getJsonMapConfig()方法的一些代码示例,展示了Config.getJsonMapConfig()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getJsonMapConfig()方法的具体详情如下:
包路径:com.networknt.config.Config
类名称:Config
方法名:getJsonMapConfig

Config.getJsonMapConfig介绍

暂无

代码示例

代码示例来源:origin: networknt/light-4j

public KeyRequest(String kid) {
  Map<String, Object> clientConfig = Config.getInstance().getJsonMapConfig(Http2Client.CONFIG_NAME);
  // client_secret is in secret.yml instead of client.yml
  if(clientConfig != null) {
    Map<String, Object> oauthConfig = (Map<String, Object>)clientConfig.get(OAUTH);
    if(oauthConfig != null) {
      Map<String, Object> keyConfig = (Map<String, Object>)oauthConfig.get(KEY);
      if(keyConfig != null) {
        setServerUrl((String)keyConfig.get(SERVER_URL));
        Object object = keyConfig.get(ENABLE_HTTP2);
        setEnableHttp2(object != null && (Boolean) object);
        setUri(keyConfig.get(URI) + "/" + kid);
        setClientId((String)keyConfig.get(CLIENT_ID));
        setClientSecret((String)secret.get(SecretConstants.KEY_CLIENT_SECRET));
      }
    }
  }
}

代码示例来源:origin: networknt/light-4j

public DerefRequest(String token) {
  Map<String, Object> clientConfig = Config.getInstance().getJsonMapConfig(Http2Client.CONFIG_NAME);
  // client_secret is in secret.yml instead of client.yml
  if(clientConfig != null) {
    Map<String, Object> oauthConfig = (Map<String, Object>)clientConfig.get(OAUTH);
    if(oauthConfig != null) {
      Map<String, Object> derefConfig = (Map<String, Object>)oauthConfig.get(DEREF);
      if(derefConfig != null) {
        setServerUrl((String)derefConfig.get(SERVER_URL));
        Object object = derefConfig.get(ENABLE_HTTP2);
        setEnableHttp2(object != null && (Boolean) object);
        setUri(derefConfig.get(URI) + "/" + token);
        setClientId((String)derefConfig.get(CLIENT_ID));
        setClientSecret((String)secret.get(SecretConstants.DEREF_CLIENT_SECRET));
      }
    }
  }
}

代码示例来源:origin: networknt/light-4j

protected HikariDataSource createDataSource() {
  // get the configured datasources
  Map<String, Object> dataSourceMap = Config.getInstance().getJsonMapConfig(DATASOURCE);
  // get the decrypted secret file
  Map<String, Object> secret = DecryptUtil.decryptMap(Config.getInstance().getJsonMapConfig(SECRET));
  // get the requested datasource
  Map<String, Object> mainParams = (Map<String, Object>) dataSourceMap.get(getDsName());
  Map<String, String> configParams = (Map<String, String>)mainParams.get("parameters");
  // create the DataSource
  ds = new HikariDataSource();
  ds.setJdbcUrl((String)mainParams.get("jdbcUrl"));
  ds.setUsername((String)mainParams.get("username"));
  // use encrypted password
  ds.setPassword((String)secret.get(getDbPassKey()));
  // set datasource paramters
  ds.setMaximumPoolSize((Integer)mainParams.get("maximumPoolSize"));
  ds.setConnectionTimeout((Integer)mainParams.get("connectionTimeout"));
  // add datasource specific connection parameters
  if(configParams != null) configParams.forEach((k, v) -> ds.addDataSourceProperty(k, v));
  return ds;
}

代码示例来源:origin: networknt/light-4j

public RefreshTokenRequest() {
  setGrantType(REFRESH_TOKEN);
  Map<String, Object> clientConfig = Config.getInstance().getJsonMapConfig(Http2Client.CONFIG_NAME);
  // client_secret is in secret.yml instead of client.yml
  if(clientConfig != null) {
    Map<String, Object> oauthConfig = (Map<String, Object>)clientConfig.get(OAUTH);
    if(oauthConfig != null) {
      Map<String, Object> tokenConfig = (Map<String, Object>)oauthConfig.get(TOKEN);
      if(tokenConfig != null) {
        setServerUrl((String)tokenConfig.get(SERVER_URL));
        Object object = tokenConfig.get(ENABLE_HTTP2);
        setEnableHttp2(object != null && (Boolean) object);
        Map<String, Object> rtConfig = (Map<String, Object>) tokenConfig.get(REFRESH_TOKEN);
        if(rtConfig != null) {
          setClientId((String)rtConfig.get(CLIENT_ID));
          setClientSecret((String)secret.get(SecretConstants.REFRESH_TOKEN_CLIENT_SECRET));
          setUri((String)rtConfig.get(URI));
          setScope((List<String>)rtConfig.get(SCOPE));
        }
      }
    }
  }
}

代码示例来源:origin: networknt/light-4j

/**
 * load default values from client.json for authorization code grant, overwrite by setters
 * in case you want to change it at runtime.
 */
public AuthorizationCodeRequest() {
  setGrantType(AUTHORIZATION_CODE);
  Map<String, Object> clientConfig = Config.getInstance().getJsonMapConfig(Http2Client.CONFIG_NAME);
  // client_secret is in secret.yml instead of client.yml
  if(clientConfig != null) {
    Map<String, Object> oauthConfig = (Map<String, Object>)clientConfig.get(OAUTH);
    if(oauthConfig != null) {
      Map<String, Object> tokenConfig = (Map<String, Object>)oauthConfig.get(TOKEN);
      if(tokenConfig != null) {
        setServerUrl((String)tokenConfig.get(SERVER_URL));
        Object object = tokenConfig.get(ENABLE_HTTP2);
        setEnableHttp2(object != null && (Boolean) object);
        Map<String, Object> acConfig = (Map<String, Object>) tokenConfig.get(AUTHORIZATION_CODE);
        if(acConfig != null) {
          setClientId((String)acConfig.get(CLIENT_ID));
          setClientSecret((String)secret.get(SecretConstants.AUTHORIZATION_CODE_CLIENT_SECRET));
          setUri((String)acConfig.get(URI));
          setScope((List<String>)acConfig.get(SCOPE));
          setRedirectUri((String)acConfig.get(REDIRECT_URI));
        }
      }
    }
  }
}

代码示例来源:origin: networknt/light-4j

public ClientCredentialsRequest() {
    setGrantType(CLIENT_CREDENTIALS);
    Map<String, Object> clientConfig = Config.getInstance().getJsonMapConfig(Http2Client.CONFIG_NAME);
    // client_secret is in secret.yml instead of client.yml
    if(clientConfig != null) {
      Map<String, Object> oauthConfig = (Map<String, Object>)clientConfig.get(OAUTH);
      if(oauthConfig != null) {
        Map<String, Object> tokenConfig = (Map<String, Object>)oauthConfig.get(TOKEN);
        if(tokenConfig != null) {
          setServerUrl((String)tokenConfig.get(SERVER_URL));
          Object object = tokenConfig.get(ENABLE_HTTP2);
          setEnableHttp2(object != null && (Boolean) object);
          Map<String, Object> ccConfig = (Map<String, Object>) tokenConfig.get(CLIENT_CREDENTIALS);
          if(ccConfig != null) {
            setClientId((String)ccConfig.get(CLIENT_ID));
            setClientSecret((String)secret.get(SecretConstants.CLIENT_CREDENTIALS_CLIENT_SECRET));
            setUri((String)ccConfig.get(URI));
            setScope((List<String>)ccConfig.get(SCOPE));
          }
        }
      }
    }
  }
}

代码示例来源:origin: networknt/light-rest-4j

@Override
public void register() {
  ModuleRegistry.registerModule(SwaggerHandler.class.getName(), Config.getInstance().getJsonMapConfig(CONFIG_NAME), null);
}

代码示例来源:origin: networknt/light-rest-4j

@Override
  public void register() {
    ModuleRegistry.registerModule(OpenApiHandler.class.getName(), Config.getInstance().getJsonMapConfig(CONFIG_NAME), null);
  }
}

代码示例来源:origin: com.networknt/client

public DerefRequest(String token) {
  Map<String, Object> clientConfig = Config.getInstance().getJsonMapConfig(Http2Client.CONFIG_NAME);
  // client_secret is in secret.yml instead of client.yml
  if(clientConfig != null) {
    Map<String, Object> oauthConfig = (Map<String, Object>)clientConfig.get(OAUTH);
    if(oauthConfig != null) {
      Map<String, Object> derefConfig = (Map<String, Object>)oauthConfig.get(DEREF);
      if(derefConfig != null) {
        setServerUrl((String)derefConfig.get(SERVER_URL));
        Object object = derefConfig.get(ENABLE_HTTP2);
        setEnableHttp2(object != null && (Boolean) object);
        setUri(derefConfig.get(URI) + "/" + token);
        setClientId((String)derefConfig.get(CLIENT_ID));
        setClientSecret((String)secret.get(SecretConstants.DEREF_CLIENT_SECRET));
      }
    }
  }
}

代码示例来源:origin: com.networknt/client

public KeyRequest(String kid) {
  Map<String, Object> clientConfig = Config.getInstance().getJsonMapConfig(Http2Client.CONFIG_NAME);
  // client_secret is in secret.yml instead of client.yml
  if(clientConfig != null) {
    Map<String, Object> oauthConfig = (Map<String, Object>)clientConfig.get(OAUTH);
    if(oauthConfig != null) {
      Map<String, Object> keyConfig = (Map<String, Object>)oauthConfig.get(KEY);
      if(keyConfig != null) {
        setServerUrl((String)keyConfig.get(SERVER_URL));
        Object object = keyConfig.get(ENABLE_HTTP2);
        setEnableHttp2(object != null && (Boolean) object);
        setUri(keyConfig.get(URI) + "/" + kid);
        setClientId((String)keyConfig.get(CLIENT_ID));
        setClientSecret((String)secret.get(SecretConstants.KEY_CLIENT_SECRET));
      }
    }
  }
}

代码示例来源:origin: com.networknt/client

public RefreshTokenRequest() {
  setGrantType(REFRESH_TOKEN);
  Map<String, Object> clientConfig = Config.getInstance().getJsonMapConfig(Http2Client.CONFIG_NAME);
  // client_secret is in secret.yml instead of client.yml
  if(clientConfig != null) {
    Map<String, Object> oauthConfig = (Map<String, Object>)clientConfig.get(OAUTH);
    if(oauthConfig != null) {
      Map<String, Object> tokenConfig = (Map<String, Object>)oauthConfig.get(TOKEN);
      if(tokenConfig != null) {
        setServerUrl((String)tokenConfig.get(SERVER_URL));
        Object object = tokenConfig.get(ENABLE_HTTP2);
        setEnableHttp2(object != null && (Boolean) object);
        Map<String, Object> rtConfig = (Map<String, Object>) tokenConfig.get(REFRESH_TOKEN);
        if(rtConfig != null) {
          setClientId((String)rtConfig.get(CLIENT_ID));
          setClientSecret((String)secret.get(SecretConstants.REFRESH_TOKEN_CLIENT_SECRET));
          setUri((String)rtConfig.get(URI));
          setScope((List<String>)rtConfig.get(SCOPE));
        }
      }
    }
  }
}

代码示例来源:origin: com.networknt/client

public ClientCredentialsRequest() {
    setGrantType(CLIENT_CREDENTIALS);
    Map<String, Object> clientConfig = Config.getInstance().getJsonMapConfig(Http2Client.CONFIG_NAME);
    // client_secret is in secret.yml instead of client.yml
    if(clientConfig != null) {
      Map<String, Object> oauthConfig = (Map<String, Object>)clientConfig.get(OAUTH);
      if(oauthConfig != null) {
        Map<String, Object> tokenConfig = (Map<String, Object>)oauthConfig.get(TOKEN);
        if(tokenConfig != null) {
          setServerUrl((String)tokenConfig.get(SERVER_URL));
          Object object = tokenConfig.get(ENABLE_HTTP2);
          setEnableHttp2(object != null && (Boolean) object);
          Map<String, Object> ccConfig = (Map<String, Object>) tokenConfig.get(CLIENT_CREDENTIALS);
          if(ccConfig != null) {
            setClientId((String)ccConfig.get(CLIENT_ID));
            setClientSecret((String)secret.get(SecretConstants.CLIENT_CREDENTIALS_CLIENT_SECRET));
            setUri((String)ccConfig.get(URI));
            setScope((List<String>)ccConfig.get(SCOPE));
          }
        }
      }
    }
  }
}

代码示例来源:origin: com.networknt/client

/**
 * load default values from client.json for authorization code grant, overwrite by setters
 * in case you want to change it at runtime.
 */
public AuthorizationCodeRequest() {
  setGrantType(AUTHORIZATION_CODE);
  Map<String, Object> clientConfig = Config.getInstance().getJsonMapConfig(Http2Client.CONFIG_NAME);
  // client_secret is in secret.yml instead of client.yml
  if(clientConfig != null) {
    Map<String, Object> oauthConfig = (Map<String, Object>)clientConfig.get(OAUTH);
    if(oauthConfig != null) {
      Map<String, Object> tokenConfig = (Map<String, Object>)oauthConfig.get(TOKEN);
      if(tokenConfig != null) {
        setServerUrl((String)tokenConfig.get(SERVER_URL));
        Object object = tokenConfig.get(ENABLE_HTTP2);
        setEnableHttp2(object != null && (Boolean) object);
        Map<String, Object> acConfig = (Map<String, Object>) tokenConfig.get(AUTHORIZATION_CODE);
        if(acConfig != null) {
          setClientId((String)acConfig.get(CLIENT_ID));
          setClientSecret((String)secret.get(SecretConstants.AUTHORIZATION_CODE_CLIENT_SECRET));
          setUri((String)acConfig.get(URI));
          setScope((List<String>)acConfig.get(SCOPE));
          setRedirectUri((String)acConfig.get(REDIRECT_URI));
        }
      }
    }
  }
}

代码示例来源:origin: networknt/light-oauth2

if(logger.isDebugEnabled()) logger.debug("keyId = " + keyId);
Map<String, Object> config = Config.getInstance().getJsonMapConfig(CONFIG_SECURITY);
Map<String, Object> jwtConfig = (Map<String, Object>)config.get(CONFIG_JWT);
Map<String, Object> certificateConfig = (Map<String, Object>)jwtConfig.get(CONFIG_CERTIFICATE);

相关文章