当前位置: 首页>>代码示例>>Java>>正文


Java WSPasswordCallback.SIGNATURE属性代码示例

本文整理汇总了Java中org.apache.ws.security.WSPasswordCallback.SIGNATURE属性的典型用法代码示例。如果您正苦于以下问题:Java WSPasswordCallback.SIGNATURE属性的具体用法?Java WSPasswordCallback.SIGNATURE怎么用?Java WSPasswordCallback.SIGNATURE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.ws.security.WSPasswordCallback的用法示例。


在下文中一共展示了WSPasswordCallback.SIGNATURE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {

		WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[0];
		String id = pwcb.getIdentifier();
		int usage = pwcb.getUsage();

		if (usage == WSPasswordCallback.USERNAME_TOKEN) {

			if ("admin".equals(id)) {
				pwcb.setPassword("admin");
			} else if ("[email protected]".equals(id)) {
				pwcb.setPassword("admin123");
			}

		} else if (usage == WSPasswordCallback.SIGNATURE || usage == WSPasswordCallback.DECRYPT) {

			if ("wso2carbon".equals(id)) {
				pwcb.setPassword("wso2carbon");
			}
		}
	}
 
开发者ID:wso2,项目名称:product-ei,代码行数:21,代码来源:SecurityWithServiceDescriptorTest.java

示例2: handle

public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {

        WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[0];
        String id = pwcb.getIdentifer();
        int usage = pwcb.getUsage();

        if (usage == WSPasswordCallback.SIGNATURE || usage == WSPasswordCallback.DECRYPT) {
            // Logic to get the private key password for signture or decryption
            if ("client".equals(id)) {
                pwcb.setPassword("automation");

            } else if ("service".equals(id)) {
                pwcb.setPassword("automation");

            } else if ("wso2carbon".equals(id)) {
                pwcb.setPassword("wso2carbon");

            } else if ("alice".equals(id)) {
                pwcb.setPassword("password");

            } else if ("bob".equals(id)) {
                pwcb.setPassword("password");

            }
        }
    }
 
开发者ID:wso2,项目名称:product-ei,代码行数:26,代码来源:SecureAxisServiceClient.java

示例3: handle

public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
    WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[0];
    String id = pwcb.getIdentifier();
    int usage = pwcb.getUsage();
    if (usage == WSPasswordCallback.SIGNATURE || usage == WSPasswordCallback.DECRYPT) {
        // Logic to get the private key password for signture or decryption
        if ("client".equals(id)) {
            pwcb.setPassword("automation");
        } else if ("service".equals(id)) {
            pwcb.setPassword("automation");
        } else if ("wso2carbon".equals(id)) {
            pwcb.setPassword("wso2carbon");
        } else if ("alice".equals(id)) {
            pwcb.setPassword("password");
        } else if ("bob".equals(id)) {
            pwcb.setPassword("password");
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-platform-integration-utils,代码行数:19,代码来源:SecureAxisServiceClient.java

示例4: constructPasswordCallback

private WSPasswordCallback constructPasswordCallback(
        String username,
        int doAction
) throws WSSecurityException {

    int reason = WSPasswordCallback.UNKNOWN;

    switch (doAction) {
    case WSConstants.UT:
    case WSConstants.UT_SIGN:
        reason = WSPasswordCallback.USERNAME_TOKEN;
        break;
    case WSConstants.SIGN:
        reason = WSPasswordCallback.SIGNATURE;
        break;
    case WSConstants.ENCR:
        reason = WSPasswordCallback.KEY_NAME;
        break;
    }
    return new WSPasswordCallback(username, reason);
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:21,代码来源:WSHandler.java

示例5: handle

public void handle(Callback[] callbacks)
    throws IOException, UnsupportedCallbackException {
    for (int i = 0; i < callbacks.length; i++) {
        if (callbacks[i] instanceof WSPasswordCallback) {
            WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
            if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN
                    && "alice".equals(pc.getIdentifier())) {
                pc.setPassword("verySecret");
            } else if (pc.getUsage() == WSPasswordCallback.SIGNATURE
                    && "wss86".equals(pc.getIdentifier())) {
                pc.setPassword("security");
            } else {
                throw new IOException("Authentication failed");
            }
        } else {
            throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:19,代码来源:TestWSSecurityWSS194.java


注:本文中的org.apache.ws.security.WSPasswordCallback.SIGNATURE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。