本文整理汇总了Java中org.apache.ws.security.WSPasswordCallback.setKey方法的典型用法代码示例。如果您正苦于以下问题:Java WSPasswordCallback.setKey方法的具体用法?Java WSPasswordCallback.setKey怎么用?Java WSPasswordCallback.setKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ws.security.WSPasswordCallback
的用法示例。
在下文中一共展示了WSPasswordCallback.setKey方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import org.apache.ws.security.WSPasswordCallback; //导入方法依赖的package包/类
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];
/*
* here call a function/method to lookup the password for
* the given identifier (e.g. a user name or keystore alias)
* e.g.: pc.setPassword(passStore.getPassword(pc.getIdentfifier))
* for testing we supply a fixed name/fixed key here.
*/
if (pc.getUsage() == WSPasswordCallback.KEY_NAME) {
pc.setKey(key);
}
else {
pc.setPassword("security");
}
} else {
throw new UnsupportedCallbackException(
callbacks[i], "Unrecognized Callback");
}
}
}
示例2: handle
import org.apache.ws.security.WSPasswordCallback; //导入方法依赖的package包/类
/**
* Method handle
*
* @param callbacks
* @throws IOException
* @throws UnsupportedCallbackException
*/
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];
/*
* here call a function/method to lookup the password for
* the given identifier (e.g. a user name or keystore alias)
* e.g.: pc.setPassword(passStore.getPassword(pc.getIdentfifier))
* for Testing we supply a fixed name here.
*/
if (pc.getUsage() == WSPasswordCallback.KEY_NAME) {
pc.setKey(key);
} else {
pc.setPassword("security");
}
} else {
throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback");
}
}
}
示例3: handle
import org.apache.ws.security.WSPasswordCallback; //导入方法依赖的package包/类
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];
/*
* here call a function/method to lookup the password for
* the given identifier (e.g. a user name or keystore alias)
* e.g.: pc.setPassword(passStore.getPassword(pc.getIdentfifier))
* for Testing we supply a fixed name here.
*/
pc.setPassword("security");
pc.setKey(keyData);
} else {
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
}
}
}
示例4: handle
import org.apache.ws.security.WSPasswordCallback; //导入方法依赖的package包/类
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];
/*
* here call a function/method to lookup the password for
* the given identifier (e.g. a user name or keystore alias)
* e.g.: pc.setPassword(passStore.getPassword(pc.getIdentfifier))
* for Testing we supply a fixed name here.
*/
if (pc.getUsage() == WSPasswordCallback.KEY_NAME) {
pc.setKey(key);
}
else {
pc.setPassword("security");
}
} else {
throw new UnsupportedCallbackException(
callbacks[i],
"Unrecognized Callback");
}
}
}
示例5: handle
import org.apache.ws.security.WSPasswordCallback; //导入方法依赖的package包/类
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) {
pc.setPassword("Sri Lanka Sri Lanka UOM ");
} else if (pc.getUsage() == WSPasswordCallback.DECRYPT) {
pc.setKey("Sri Lanka Sri Lanka UOM ".getBytes());
}
} else {
throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback");
}
}
}
示例6: handle
import org.apache.ws.security.WSPasswordCallback; //导入方法依赖的package包/类
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback callback : callbacks) {
LOGGER.debug("callback type: {}", callback.getClass().getName());
if (callback instanceof WSPasswordCallback) {
WSPasswordCallback passwordCallback = (WSPasswordCallback) callback;
LOGGER.debug("token identifier: {}", passwordCallback.getIdentifier());
passwordCallback.setKey(CallbackTestHandler.tokenKey);
passwordCallback.setPassword(CallbackTestHandler.password);
}
}
}
示例7: handle
import org.apache.ws.security.WSPasswordCallback; //导入方法依赖的package包/类
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];
byte[] secret = (byte[]) this.secrets.get(pc.getIdentifier());
pc.setKey(secret);
} else {
throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback");
}
}
}
示例8: handle
import org.apache.ws.security.WSPasswordCallback; //导入方法依赖的package包/类
/**
* Method handle
*
* @param callbacks
* @throws java.io.IOException
* @throws javax.security.auth.callback.UnsupportedCallbackException
*/
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];
/*
* This usage type is used only in case we received a
* username token with a password of type PasswordText or
* an unknown password type.
*
* This case the WSPasswordCallback object contains the
* identifier (aka username), the password we received, and
* the password type string to identify the type.
*
* Here we perform only a very simple check.
*/
if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN) {
if(pc.getIdentifier().equals("Ron") && pc.getPassword().equals("noR")) {
return;
}
if (pc.getPassword().equals("sirhC")) {
return;
}
throw new UnsupportedCallbackException(callbacks[i],
"check failed");
}
/*
* here call a function/method to lookup the password for
* the given identifier (e.g. a user name or keystore alias)
* e.g.: pc.setPassword(passStore.getPassword(pc.getIdentfifier))
* for Testing we supply a fixed name here.
*/
if (pc.getUsage() == WSPasswordCallback.KEY_NAME) {
pc.setKey(key);
} else if(pc.getIdentifier().equals("alice")) {
pc.setPassword("password");
} else if(pc.getIdentifier().equals("bob")) {
pc.setPassword("password");
} else if(pc.getIdentifier().equals("Ron")) {
pc.setPassword("noR");
} else {
pc.setPassword("sirhC");
}
} else {
throw new UnsupportedCallbackException(callbacks[i],
"Unrecognized Callback");
}
}
}