@Override protected AbstractOutboundProvisioningConnector buildConnector( Property[] provisioningProperties) throws IdentityProvisioningException { SalesforceProvisioningConnector salesforceConnector = new SalesforceProvisioningConnector(); salesforceConnector.init(provisioningProperties); if (log.isDebugEnabled()) { log.debug("Salesforce provisioning connector created successfully."); } return salesforceConnector; }
/** * @param provisioningEntity * @throws IdentityProvisioningException */ private void deleteUser(ProvisioningEntity provisioningEntity) throws IdentityProvisioningException { JSONObject entity = new JSONObject(); try { entity.put(SalesforceConnectorConstants.IS_ACTIVE, false); entity.put(SalesforceConnectorConstants.USERNAME_ATTRIBUTE, alterUsername(provisioningEntity)); update(provisioningEntity.getIdentifier().getIdentifier(), entity); } catch (JSONException e) { log.error("Error while creating JSON body"); throw new IdentityProvisioningException(e); } }
if (provisioningEntity.isJitProvisioning() && !isJitProvisioningEnabled()) { log.debug("JIT provisioning disabled for Salesforce connector"); return null; deleteUser(provisioningEntity); } else if (provisioningEntity.getOperation() == ProvisioningOperation.POST) { provisionedId = createUser(provisioningEntity); } else if (provisioningEntity.getOperation() == ProvisioningOperation.PUT) { update(provisioningEntity.getIdentifier().getIdentifier(), buildJsonObject(provisioningEntity)); } else { log.warn("Unsupported provisioning opertaion.");
JSONObject user = buildJsonObject(provisioningEntity); PostMethod post = new PostMethod(this.getUserObjectEndpoint()); setAuthorizationHeader(post); + " text : " + post.getStatusText()); if (isDebugEnabled) { log.debug("Error response : " + readResponse(post));
PostMethod patch = new PostMethod(this.getUserObjectEndpoint() + provsionedId) { @Override public String getName() { setAuthorizationHeader(patch); patch.setRequestEntity(new StringRequestEntity(entity.toString(), "application/json", null)); + " text : " + patch.getStatusText()); if (isDebugEnabled) { log.debug("Error response : " + readResponse(patch));
GetMethod get = new GetMethod(this.getDataQueryEndpoint()); setAuthorizationHeader(get);
Map<String, String> requiredAttributes = getSingleValuedClaims(provisioningEntity .getAttributes()); userIdFromPattern = buildUserId(provisioningEntity, provisioningPattern, provisioningSeparator, idpName);
/** * adding OAuth authorization headers to a httpMethod * * @param httpMethod method which wants to add Authorization header */ private void setAuthorizationHeader(HttpMethodBase httpMethod) throws IdentityProvisioningException { boolean isDebugEnabled = log.isDebugEnabled(); String accessToken = authenticate(); if (StringUtils.isNotBlank(accessToken)) { httpMethod.setRequestHeader(SalesforceConnectorConstants.AUTHORIZATION_HEADER_NAME, SalesforceConnectorConstants.AUTHORIZATION_HEADER_OAUTH + " " + accessToken); if (isDebugEnabled) { log.debug("Setting authorization header for method : " + httpMethod.getName() + " as follows,"); Header authorizationHeader = httpMethod .getRequestHeader(SalesforceConnectorConstants.AUTHORIZATION_HEADER_NAME); log.debug(authorizationHeader.getName() + ": " + authorizationHeader.getValue()); } } else { throw new IdentityProvisioningException("Authentication failed"); } }