Java Code Examples for org.apache.ws.security.WSPasswordCallback#SIGNATURE

The following examples show how to use org.apache.ws.security.WSPasswordCallback#SIGNATURE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecureAxisServiceClient.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
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");

            }
        }
    }
 
Example 2
Source File: SecurityWithServiceDescriptorTest.java    From product-ei with Apache License 2.0 6 votes vote down vote up
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");
			}
		}
	}
 
Example 3
Source File: SecureAxisServiceClient.java    From product-ei with Apache License 2.0 6 votes vote down vote up
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");

            }
        }
    }