Java 您如何通过Cisco联络中心快速身份验证服务?

Java 您如何通过Cisco联络中心快速身份验证服务?,java,oauth,cisco,Java,Oauth,Cisco,我正在构建一个第三方应用程序,以通过Contact Center Express进行身份验证。文件是必要的,但不足以完成这一点。比如说, 何时何地将用户重定向到联系中心进行身份验证?我观察到Finesse会将用户重定向到 但是在哪里指定使用标识服务(IDS)路径/IDS/v1/oauth/authorize?状态是必需的参数吗?IDS SDK是否处理回调路径/desktop/sso/authcode?我想它不会,但是发送给它的参数是什么?我使用的是Spring框架 我是要对整个过程进行逆向工

我正在构建一个第三方应用程序,以通过Contact Center Express进行身份验证。文件是必要的,但不足以完成这一点。比如说,

何时何地将用户重定向到联系中心进行身份验证?我观察到Finesse会将用户重定向到

但是在哪里指定使用标识服务(IDS)路径
/IDS/v1/oauth/authorize
?状态是必需的参数吗?IDS SDK是否处理回调路径
/desktop/sso/authcode
?我想它不会,但是发送给它的参数是什么?我使用的是Spring框架

我是要对整个过程进行逆向工程,还是缺少其他文档

即使在我收到OAuth令牌之后,我如何使用它对其他Cisco产品进行其他REST调用?Finesse REST API只提到HTTP基本身份验证。没有提到“Authorization:Bearer”令牌的头


在所有重定向之后,我不得不对其进行反向工程

@Controller
public class SSOController {

    @Autowired
    private IdSClientConfigurationImpl config;

    @Autowired 
    private IdSClient client;

    @PostMapping("/login")
    public String login(@RequestParam(name="user", required=true) String user) {
        // redirect the user to the Cisco Contact Center Express Identity Service
        String redirectURI = config.getRedirectUri();
        String clientId = config.getClientId();

        URI uri = UriComponentsBuilder
                .fromUriString("https://contact-center-express:8553/ids/v1/oauth/authorize")
                .queryParam("redirect_uri", "{redirect_uri}")
                .queryParam("client_id", "{client_id}")
//              .queryParam("state", "{state}") // base64 encoded
                .queryParam("response_type", "code")
                .build(redirectURI, clientId);
        return "redirect:"+uri.toString();
    }

    @GetMapping("/idscallback")
    public String idscallback(
            @RequestParam(name="code", required=true) String code, 
            @RequestParam(name="state", required=false) String state,
            HttpSession session) throws IdSClientException {

        // Get Access Token for the received Authorization Code
        String redirectURI = config.getRedirectUri();
        AccessToken token = client.getAccessToken(code, redirectURI); // why do I need redirectURI when it's already redirected?
        String accessTokenString = token.getAccess_token();
        session.setAttribute("token", accessTokenString);
//      model.addAttribute("token", accessTokenString);     
        return "redirect:/";
    }
在遥远的豆子里

    @Bean
    public IdSClientConfigurationImpl config() throws IOException, IdSClientException {
        ClassPathResource idsclientResource = new ClassPathResource("idsclient.properties");
        IdSClientConfigurationImpl config = new IdSClientConfigurationImpl(idsclientResource.getFile().getPath());
//      IdSClientConfigurationImpl config = new IdSClientConfigurationImpl("src/main/resources/idsclient.properties");
        config.load();
        return config;
    }

    @Bean
    public IdSClient setupIdsClient() throws IOException, IdSClientException {
        IdSClient client = IdSClientFactory.getIdSClient();
        client.setTLSContext(createSSLTrustManager(), createHostnameVerifier());
//      client.setTLSContext(arg0, arg1) // use secure trust manager and hostname verifier in production
        client.init(config);
        return client;
    }

    private X509TrustManager createSSLTrustManager() {
        X509TrustManager tm = new TrustAllX509TrustManager();
        return tm;  
    }

    private HostnameVerifier createHostnameVerifier() {
        HostnameVerifier hv = new SkipAllHostNameVerifier();
        return hv;
    }

我目前没有任何UCCX设置来测试它,但根据文档,rest API似乎只支持基本身份验证,添加了base64中编码的标题
Authorization:username:password
。如果它支持OAuth(我不确定),您可以尝试使用
授权:Bearer
@AlexRoig OK我尝试使用Bearer令牌从Finesse访问用户信息,但我收到了一条XML错误消息(这比我通常得到的要多):
身份验证凭据中指定的用户和uri don't match
。能否共享idsclient.properties文件的内容?
    @Bean
    public IdSClientConfigurationImpl config() throws IOException, IdSClientException {
        ClassPathResource idsclientResource = new ClassPathResource("idsclient.properties");
        IdSClientConfigurationImpl config = new IdSClientConfigurationImpl(idsclientResource.getFile().getPath());
//      IdSClientConfigurationImpl config = new IdSClientConfigurationImpl("src/main/resources/idsclient.properties");
        config.load();
        return config;
    }

    @Bean
    public IdSClient setupIdsClient() throws IOException, IdSClientException {
        IdSClient client = IdSClientFactory.getIdSClient();
        client.setTLSContext(createSSLTrustManager(), createHostnameVerifier());
//      client.setTLSContext(arg0, arg1) // use secure trust manager and hostname verifier in production
        client.init(config);
        return client;
    }

    private X509TrustManager createSSLTrustManager() {
        X509TrustManager tm = new TrustAllX509TrustManager();
        return tm;  
    }

    private HostnameVerifier createHostnameVerifier() {
        HostnameVerifier hv = new SkipAllHostNameVerifier();
        return hv;
    }