Search in sources :

Example 1 with ClientRegistrationType

use of org.gluu.model.custom.script.type.client.ClientRegistrationType in project oxAuth by GluuFederation.

the class ExternalDynamicClientRegistrationService method executeExternalCreateClientMethod.

public boolean executeExternalCreateClientMethod(CustomScriptConfiguration customScriptConfiguration, RegisterRequest registerRequest, Client client) {
    try {
        log.trace("Executing python 'createClient' method");
        ClientRegistrationType externalClientRegistrationType = (ClientRegistrationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalClientRegistrationType.createClient(registerRequest, client, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return false;
}
Also used : SimpleCustomProperty(org.gluu.model.SimpleCustomProperty) ClientRegistrationType(org.gluu.model.custom.script.type.client.ClientRegistrationType)

Example 2 with ClientRegistrationType

use of org.gluu.model.custom.script.type.client.ClientRegistrationType in project oxAuth by GluuFederation.

the class ExternalDynamicClientRegistrationService method executeExternalUpdateClientMethod.

public boolean executeExternalUpdateClientMethod(CustomScriptConfiguration customScriptConfiguration, RegisterRequest registerRequest, Client client) {
    try {
        log.trace("Executing python 'updateClient' method");
        ClientRegistrationType externalClientRegistrationType = (ClientRegistrationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalClientRegistrationType.updateClient(registerRequest, client, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return false;
}
Also used : SimpleCustomProperty(org.gluu.model.SimpleCustomProperty) ClientRegistrationType(org.gluu.model.custom.script.type.client.ClientRegistrationType)

Example 3 with ClientRegistrationType

use of org.gluu.model.custom.script.type.client.ClientRegistrationType in project oxAuth by GluuFederation.

the class ExternalDynamicClientRegistrationService method getSoftwareStatementJwks.

public JSONObject getSoftwareStatementJwks(HttpServletRequest httpRequest, JSONObject registerRequest, Jwt softwareStatement) {
    try {
        log.trace("Executing python 'getSoftwareStatementJwks' method");
        DynamicClientRegistrationContext context = new DynamicClientRegistrationContext(httpRequest, registerRequest, defaultExternalCustomScript);
        context.setSoftwareStatement(softwareStatement);
        ClientRegistrationType externalType = (ClientRegistrationType) defaultExternalCustomScript.getExternalType();
        final String result = externalType.getSoftwareStatementJwks(context);
        log.trace("Result of python 'getSoftwareStatementJwks' method: " + result);
        return new JSONObject(result);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(defaultExternalCustomScript.getCustomScript(), ex);
        return null;
    }
}
Also used : JSONObject(org.json.JSONObject) ClientRegistrationType(org.gluu.model.custom.script.type.client.ClientRegistrationType) DynamicClientRegistrationContext(org.gluu.oxauth.service.external.context.DynamicClientRegistrationContext)

Example 4 with ClientRegistrationType

use of org.gluu.model.custom.script.type.client.ClientRegistrationType in project oxAuth by GluuFederation.

the class ExternalDynamicClientRegistrationService method getSoftwareStatementHmacSecret.

public String getSoftwareStatementHmacSecret(HttpServletRequest httpRequest, JSONObject registerRequest, Jwt softwareStatement) {
    try {
        log.trace("Executing python 'getSoftwareStatementHmacSecret' method");
        DynamicClientRegistrationContext context = new DynamicClientRegistrationContext(httpRequest, registerRequest, defaultExternalCustomScript);
        context.setSoftwareStatement(softwareStatement);
        ClientRegistrationType externalType = (ClientRegistrationType) defaultExternalCustomScript.getExternalType();
        final String result = externalType.getSoftwareStatementHmacSecret(context);
        log.trace("Result of python 'getSoftwareStatementHmacSecret' method: " + result);
        return result;
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(defaultExternalCustomScript.getCustomScript(), ex);
        return "";
    }
}
Also used : ClientRegistrationType(org.gluu.model.custom.script.type.client.ClientRegistrationType) DynamicClientRegistrationContext(org.gluu.oxauth.service.external.context.DynamicClientRegistrationContext)

Aggregations

ClientRegistrationType (org.gluu.model.custom.script.type.client.ClientRegistrationType)4 SimpleCustomProperty (org.gluu.model.SimpleCustomProperty)2 DynamicClientRegistrationContext (org.gluu.oxauth.service.external.context.DynamicClientRegistrationContext)2 JSONObject (org.json.JSONObject)1