Search in sources :

Example 1 with Command

use of io.jans.ca.common.Command in project jans by JanssenProject.

the class RestResource method getObjectForJsonConversion.

private static <T extends IParams> Object getObjectForJsonConversion(CommandType commandType, String paramsAsString, Class<T> paramsClass, String authorization, String AuthorizationRpId) {
    LOG.trace("Command: {}", paramsAsString);
    T params = read(safeToJson(paramsAsString), paramsClass);
    final RpServerConfiguration conf = ServerLauncher.getInjector().getInstance(ConfigurationService.class).get();
    if (commandType.isAuthorizationRequired()) {
        validateAuthorizationRpId(conf, AuthorizationRpId);
        validateAccessToken(authorization, safeToRpId((HasRpIdParams) params, AuthorizationRpId));
    }
    Command command = new Command(commandType, params);
    final IOpResponse response = ServerLauncher.getInjector().getInstance(Processor.class).process(command);
    Object forJsonConversion = response;
    if (response instanceof POJOResponse) {
        forJsonConversion = ((POJOResponse) response).getNode();
    }
    return forJsonConversion;
}
Also used : POJOResponse(io.jans.ca.common.response.POJOResponse) Command(io.jans.ca.common.Command) IOpResponse(io.jans.ca.common.response.IOpResponse) JSONObject(org.json.JSONObject) ConfigurationService(io.jans.ca.server.service.ConfigurationService)

Example 2 with Command

use of io.jans.ca.common.Command in project jans by JanssenProject.

the class NotAllowedTest method registerSite.

public static RegisterSiteResponse registerSite(ClientInterface client) {
    final RegisterSiteParams params = new RegisterSiteParams();
    params.setOpHost("https://ce-dev.gluu.org");
    params.setRedirectUris(Lists.newArrayList("https://192.168.200.58:5053"));
    params.setScope(Lists.newArrayList("openid", "profile", "email", "address", "clientinfo", "mobile_phone", "phone", "uma_protection"));
    params.setPostLogoutRedirectUris(Lists.newArrayList("https://192.168.200.58:5053"));
    params.setClientFrontchannelLogoutUri("https://192.168.200.58:5053/logout");
    params.setAcrValues(Lists.newArrayList("gplus", "basic", "duo", "u2f"));
    params.setGrantTypes(Lists.newArrayList("authorization_code"));
    final Command command = new Command(CommandType.REGISTER_SITE);
    command.setParamsObject(params);
    final RegisterSiteResponse resp = client.registerSite(params);
    assertNotNull(resp);
    assertTrue(!Strings.isNullOrEmpty(resp.getRpId()));
    return resp;
}
Also used : Command(io.jans.ca.common.Command) RegisterSiteParams(io.jans.ca.common.params.RegisterSiteParams) RegisterSiteResponse(io.jans.ca.common.response.RegisterSiteResponse)

Aggregations

Command (io.jans.ca.common.Command)2 RegisterSiteParams (io.jans.ca.common.params.RegisterSiteParams)1 IOpResponse (io.jans.ca.common.response.IOpResponse)1 POJOResponse (io.jans.ca.common.response.POJOResponse)1 RegisterSiteResponse (io.jans.ca.common.response.RegisterSiteResponse)1 ConfigurationService (io.jans.ca.server.service.ConfigurationService)1 JSONObject (org.json.JSONObject)1