Java Code Examples for org.apache.wss4j.common.ext.WSPasswordCallback#setPassword()
The following examples show how to use
org.apache.wss4j.common.ext.WSPasswordCallback#setPassword() .
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: CustomPasswordHandler.java From tomee with Apache License 2.0 | 6 votes |
@Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN) { // TODO get the password from the users.properties if possible pc.setPassword("waterfall"); } else if (pc.getUsage() == WSPasswordCallback.DECRYPT) { pc.setPassword("serverPassword"); } else if (pc.getUsage() == WSPasswordCallback.SIGNATURE) { pc.setPassword("serverPassword"); } }
Example 2
Source File: KeystorePasswordCallback.java From cxf with Apache License 2.0 | 6 votes |
/** * It attempts to get the password from the private * alias/passwords map. */ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { WSPasswordCallback pc = (WSPasswordCallback)callbacks[i]; if (pc.getUsage() == WSPasswordCallback.PASSWORD_ENCRYPTOR_PASSWORD) { pc.setPassword("this-is-a-secret"); } else { String pass = passwords.get(pc.getIdentifier()); if (pass != null) { pc.setPassword(pass); return; } pc.setPassword("password"); } } }
Example 3
Source File: CommonCallbackHandler.java From cxf-fediz with Apache License 2.0 | 6 votes |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof WSPasswordCallback) { // CXF WSPasswordCallback pc = (WSPasswordCallback) callbacks[i]; if ("ALICE".equals(pc.getIdentifier())) { pc.setPassword("ECILA"); break; } else if ("realmb".equals(pc.getIdentifier())) { pc.setPassword("realmb"); break; } else if (pc.getIdentifier() != null && pc.getIdentifier().startsWith("consumer-id")) { pc.setPassword("this-is-a-secret"); break; } } } }
Example 4
Source File: KeystorePasswordCallback.java From cxf with Apache License 2.0 | 6 votes |
/** * It attempts to get the password from the private * alias/passwords map. */ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { WSPasswordCallback pc = (WSPasswordCallback)callbacks[i]; if ("alice".equals(pc.getIdentifier())) { pc.setPassword("password"); } else if ("bob".equals(pc.getIdentifier())) { pc.setPassword("password"); } else if ("morpit".equals(pc.getIdentifier())) { pc.setPassword("password"); } else if ("bethal".equals(pc.getIdentifier())) { pc.setPassword("password"); } else { pc.setPassword("abcd!1234"); } } }
Example 5
Source File: PasswordCallbackHandler.java From cxf-fediz with Apache License 2.0 | 6 votes |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof WSPasswordCallback) { // CXF WSPasswordCallback pc = (org.apache.wss4j.common.ext.WSPasswordCallback) callbacks[i]; if ("realma".equals(pc.getIdentifier())) { pc.setPassword("realma"); break; } else if ("realmb".equals(pc.getIdentifier())) { pc.setPassword("realmb"); break; } if ("mystskey".equals(pc.getIdentifier())) { pc.setPassword("stskpass"); break; } } } }
Example 6
Source File: STSCallbackHandler.java From cxf with Apache License 2.0 | 6 votes |
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.DECRYPT || pc.getUsage() == WSPasswordCallback.SIGNATURE) { if ("mystskey".equals(pc.getIdentifier())) { pc.setPassword("stskpass"); } } else if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN) { if ("alice".equals(pc.getIdentifier())) { pc.setPassword("clarinet"); } } } } }
Example 7
Source File: ClientPasswordCallback.java From servicemix with Apache License 2.0 | 5 votes |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; if (pc.getIdentifier().equals("smx")) { pc.setPassword("smx"); } }
Example 8
Source File: UTPasswordCallback.java From cxf with Apache License 2.0 | 5 votes |
/** * Here, we attempt to get the password from the private * alias/passwords map. */ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { WSPasswordCallback pc = (WSPasswordCallback)callbacks[i]; String pass = passwords.get(pc.getIdentifier()); if (pass != null) { pc.setPassword(pass); return; } } }
Example 9
Source File: ServerPasswordCallback.java From cxf with Apache License 2.0 | 5 votes |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { WSPasswordCallback pc = (WSPasswordCallback)callbacks[i]; pc.setPassword("pass"); } }
Example 10
Source File: TestPwdCallback.java From cxf with Apache License 2.0 | 5 votes |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { WSPasswordCallback pc = (WSPasswordCallback)callbacks[i]; String pass = passwords.get(pc.getIdentifier()); if (pass != null) { pc.setPassword(pass); } } }
Example 11
Source File: UTPasswordCallback.java From cxf with Apache License 2.0 | 5 votes |
/** * Here, we attempt to get the password from the private * alias/passwords map. */ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { WSPasswordCallback pc = (WSPasswordCallback)callbacks[i]; String pass = passwords.get(pc.getIdentifier()); if (pass != null) { pc.setPassword(pass); return; } } }
Example 12
Source File: UTPasswordCallback.java From cxf with Apache License 2.0 | 5 votes |
/** * Here, we attempt to get the password from the private * alias/passwords map. */ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { WSPasswordCallback pc = (WSPasswordCallback)callbacks[i]; String pass = passwords.get(pc.getIdentifier()); if (pass != null) { pc.setPassword(pass); return; } } }
Example 13
Source File: BasicAuthenticationHandler.java From rice with Educational Community License v2.0 | 5 votes |
/** * @param callbacks an array of Callback objects * @throws RiceRuntimeException if the username or password is invalid * @see javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[]) */ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { if (callbacks[0] != null && callbacks[0] instanceof WSPasswordCallback) { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; String password = KSBServiceLocator.getBasicAuthenticationService().getPasswordForService(this.serviceNameSpaceURI, this.localServiceName, pc.getIdentifier()); pc.setPassword(password); } }
Example 14
Source File: BasicAuthenticationPasswordHandler.java From rice with Educational Community License v2.0 | 5 votes |
/** * @param callbacks an array of Callback objects * @see javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[] */ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { if (callbacks[0] != null && callbacks[0] instanceof WSPasswordCallback) { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; pc.setPassword(password); } }
Example 15
Source File: CommonCallbackHandler.java From cxf with Apache License 2.0 | 5 votes |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof WSPasswordCallback) { // CXF WSPasswordCallback pc = (WSPasswordCallback) callbacks[i]; if ("myclientkey".equals(pc.getIdentifier())) { pc.setPassword("ckpass"); break; } else if ("myservicekey".equals(pc.getIdentifier())) { pc.setPassword("skpass"); break; } else if ("alice".equals(pc.getIdentifier())) { pc.setPassword("clarinet"); break; } else if ("bob".equals(pc.getIdentifier())) { pc.setPassword("trombone"); break; } else if ("eve".equals(pc.getIdentifier())) { pc.setPassword("evekpass"); break; } else if ("mystskey".equals(pc.getIdentifier())) { pc.setPassword("stskpass"); break; } } } }
Example 16
Source File: StdInPasswordCallback.java From camelinaction2 with Apache License 2.0 | 5 votes |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; Console console = System.console(); console.printf("Please enter your Rider Auto Parts password: "); char[] passwordChars = console.readPassword(); String passwordString = new String(passwordChars); pc.setPassword(passwordString); }
Example 17
Source File: UTPasswordCallback.java From cxf with Apache License 2.0 | 5 votes |
/** * Here, we attempt to get the password from the private * alias/passwords map. */ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { WSPasswordCallback pc = (WSPasswordCallback)callbacks[i]; String pass = passwords.get(pc.getIdentifier()); if (pass != null) { pc.setPassword(pass); return; } } }
Example 18
Source File: SecurityPolicyTest.java From cxf with Apache License 2.0 | 5 votes |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; if ("bob".equals(pc.getIdentifier())) { // set the password on the callback. This will be compared to the // password which was sent from the client. pc.setPassword("pwd"); } }
Example 19
Source File: StaxRoundTripTest.java From cxf with Apache License 2.0 | 5 votes |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { WSPasswordCallback pc = (WSPasswordCallback)callbacks[i]; String pass = passwords.get(pc.getIdentifier()); if (pass != null) { pc.setPassword(pass); } } }
Example 20
Source File: ClientPasswordCallback.java From camelinaction2 with Apache License 2.0 | 4 votes |
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; pc.setPassword("secret"); }