cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
557
Views
5
Helpful
1
Replies

Trying to get SSO sample to work

lvj00000111
Level 1
Level 1

I've tried to experiment a bit with the 11.6 Finesse Sandbox and the SSO sample code from: https://github.com/CiscoDevNet/uccx-sample-code/tree/master/ids-sample-code 

 

Here's my code:

public class SampleIdSClient {
	public static void TestSSO() throws IdSClientException {
		// During SSO Service Startup
		// Load application specific IdS Client Configuration
		IdSClientConfigurationImpl config = new IdSClientConfigurationImpl(/*"C:\\temp\\idsclient.conf"*/);
		//config.load();
		config.setClientId("e152d7b351ec90ecb7899e43b626f90ba75d6e81");
		config.setProperty("sso.mode", "nonsso");
		config.setRedirectUri("http://google.com");
		config.setProperty("ids1_url", "https://hq-uccx.abc.inc:8553/ids/v1/");
		//config.setProperty("ids2_url", "https://<fully qualified host name of UCCX publisher node>:8553/ids/v1/");
		
		
		// Instantiate IdS Client
		IdSClient client = IdSClientFactory.getIdSClient();
		client.setTLSContext(createSSLTrustManager(), createHostnameVerfier());

		// Init IdS Client with application specific Configuration loaded earlier
		client.init(config);
		System.out.println("config " + config.toString());
		System.out.println("from config - sso.mode=" + config.getProperty("sso.mode"));
		System.out.println("from client - sso.mode=" + client.getIdSClientConfiguration().getSSOMode());

		String authCode = config.getClientId();
		System.out.println("ClientId "+config.getClientId());
		System.out.println("ClientSecret "+config.getClientSecret());
		
		// Get Access Token for the received Authorization Code
		String redirectURI = config.getRedirectUri();
		AccessToken token = client.getAccessToken(authCode, redirectURI);

		String accessTokenString = token.getAccess_token();
		// pass the above access token to UniAgentDesktop
		

		// To refresh the token before expiry
		@SuppressWarnings("unused")
		AccessToken refreshedToken = client.refreshAccessToken(token.getAccess_token(), token.getRefresh_token());
		// On agent logout, remove the OAuth token from ids client cache
		client.removeAccessToken/*removeToken*/(accessTokenString);


		// Cleanup when SSO Service is shutting down
		((IdSStatusMonitorImpl)client.getIdSStatusMonitor()).cleanUp();
		client.setTokenCaching(false);
	}

	private static X509TrustManager createSSLTrustManager() {
		// TODO Auto-generated method stub
		return new TrustAllX509TrustManager();
	}

	private static HostnameVerifier createHostnameVerfier() {
		// TODO Auto-generated method stub
		return new SkipAllHostNameVerifier();
	}
 

I have set things up in the finesse config as shown in the picture. I get back "401 : Invalid Auth Code." I assume I'm doing something wrong?

 

1 Reply 1

dekwan
Cisco Employee
Cisco Employee

Hi,

 

Unfortunately the 11.6 Contact Center Express sandbox is not configured for SSO.

 

Thanx,

Denise

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: