Difference between revisions of "Draft: PEC-Hybrid/Current/Admin/About"

From Genesys Documentation
Jump to: navigation, search
Line 118: Line 118:
 
</ul>
 
</ul>
 
</li>
 
</li>
 +
<li>Request Access Token as SAML IDP:
 +
<ol type="a">
 
<li>Create SAML Response Assertion to automatically provision users with the desired role in PureCloud. The following is sample code. Do not copy/paste this code. You must populate the code with the values particular to your organization:<br>
 
<li>Create SAML Response Assertion to automatically provision users with the desired role in PureCloud. The following is sample code. Do not copy/paste this code. You must populate the code with the values particular to your organization:<br>
 
<source lang="xml">
 
<source lang="xml">
Line 168: Line 170:
 
   </saml2:Assertion>
 
   </saml2:Assertion>
 
</source>
 
</source>
 +
</li>
 +
<li>Request PureCloud access token with SAMLResponse (assertion):<br>
 +
Using Curl:
 +
<source lang="curl">
 +
curl -X POST -u "978e01b1-2549-4fb6-8fab-26b9d513ea81:bJgyH77VGAa-qZd11I-FtaTKdkAkPTJBmTY4SYSGWVU" \
 +
https://login.inindca.com/token \
 +
-d grant_type=urn:ietf:params:oauth:grant-type:saml2-bearer \
 +
-d assertion=<SAMLResponse with assertion>
 +
-d orgName=chuckcustomer
 +
</source>
 +
Or, using Java:
 +
<source lang="java">
 +
CloseableHttpClient client = HttpClients.createDefault();
 +
try {
 +
    HttpPost httpPost = new HttpPost(loginHost + "/oauth/token");
 +
 +
    List<NameValuePair> params = new ArrayList<>();
 +
    params.add(new BasicNameValuePair("grant_type", "urn:ietf:params:oauth:grant-type:saml2-bearer"));
 +
    params.add(new BasicNameValuePair("orgName", orgName));
 +
    params.add(new BasicNameValuePair("assertion", assertion));
 +
    httpPost.setEntity(new UrlEncodedFormEntity(params));
 +
 +
    UsernamePasswordCredentials creds = new UsernamePasswordCredentials(clientId, clientSecret);
 +
 +
    String basicAuth = new BasicScheme().authenticate(creds, new org.apache.commons.httpclient.methods.PostMethod());
 +
    httpPost.addHeader("Authorization", basicAuth);
 +
 +
    ResponseHandler<String> responseHandler = new ResponseHandler<String>() {
 +
 +
        @Override
 +
        public String handleResponse(
 +
                final HttpResponse response) throws ClientProtocolException, IOException {
 +
            int status = response.getStatusLine().getStatusCode();
 +
            if (status >= 200 && status < 300) {
 +
                HttpEntity entity = response.getEntity();
 +
                return entity != null ? EntityUtils.toString(entity) : null;
 +
            } else {
 +
                throw new ClientProtocolException("Unexpected response status: " + status + " correlation Id: " + response.getFirstHeader("ININ-Correlation-Id"));
 +
            }
 +
        }
 +
 +
    };
 +
    String responseBody = client.execute(httpPost, responseHandler);
 +
    System.out.println(responseBody);
 +
 +
    ObjectMapper mapper = new ObjectMapper();
 +
    final AuthResponse authResponse = mapper.readValue(responseBody, AuthResponse.class);
 +
    return authResponse;
 +
 +
} finally {
 +
    client.close();
 +
}
 +
</source>
 +
</li>
 +
<li>Request users/me details from new access token using PureCloud SDK:<br>
 +
<source lang="">
 +
UsersApi api = new UsersApi(ApiClient.Builder.standard().withBasePath(apiHost).withAccessToken(authResponse.getAccess_token()).build());
 +
UserMe me = api.getUsersMe(new GetUsersMeRequest() {{ setExpand(Arrays.asList("authorization","organization","orgproducts","token"));}});
 +
ObjectMapper mapper = new ObjectMapper();
 +
System.out.println("User Details\n" + mapper.writerWithDefaultPrettyPrinter().writeValueAsString(me));
 +
</source>
 +
</li>
 +
</ol>
 
</li>
 
</li>
 
<li>By default, Altocloud permissions are included in the Admin and AI Agent roles. You may grant [https://help.mypurecloud.com/articles/altocloud-permissions-overview/ Altocloud permissions] to additional roles as needed.
 
<li>By default, Altocloud permissions are included in the Admin and AI Agent roles. You may grant [https://help.mypurecloud.com/articles/altocloud-permissions-overview/ Altocloud permissions] to additional roles as needed.

Revision as of 15:15, May 31, 2019

This is a draft page; the published version of this page can be found at PEC-Hybrid/Current/Admin/About.

This article describes the essential provisioning steps to enable a hybrid integration between PureEngage On-Prem deployments and Genesys PureCloud services.

Supported Services

About Provisioning

PureCloud Provisioning Steps

PureEngage On Premises: Transaction object for hybrid integrations

Opening Your Network