本文整理汇总了Java中org.apache.ws.security.WSConstants.UT属性的典型用法代码示例。如果您正苦于以下问题:Java WSConstants.UT属性的具体用法?Java WSConstants.UT怎么用?Java WSConstants.UT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.ws.security.WSConstants
的用法示例。
在下文中一共展示了WSConstants.UT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUsernameTokenPrincipal
/**
* Returns the UsernameTokenPrincipal from the security results.
*
* @param mc The message context of the message
* @return the UsernameTokenPrincipal from the security results as an
* <code>org.apache.ws.security.WSUsernameTokenPrincipal</code>.
* If a wsse:UsernameToken was not present in the wsse:Security header then
* <code>null</code> will be returned.
* @throws Exception If there are no security results.
* @see org.apache.ws.security.WSUsernameTokenPrincipal
*/
public static WSUsernameTokenPrincipal getUsernameTokenPrincipal(
MessageContext mc) throws Exception {
Vector results;
if ((results = (Vector) mc.getProperty(WSHandlerConstants.RECV_RESULTS)) == null) {
throw new Exception("No security results available in the message context");
} else {
for (int i = 0; i < results.size(); i++) {
WSHandlerResult rResult = (WSHandlerResult) results.get(i);
Vector wsSecEngineResults = rResult.getResults();
for (int j = 0; j < wsSecEngineResults.size(); j++) {
WSSecurityEngineResult wser =
(WSSecurityEngineResult) wsSecEngineResults.get(j);
Integer actInt = (Integer) wser
.get(WSSecurityEngineResult.TAG_ACTION);
if (actInt.intValue() == WSConstants.UT) {
return (WSUsernameTokenPrincipal) wser
.get(WSSecurityEngineResult.TAG_PRINCIPAL);
}
}
}
}
return null;
}
示例2: 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);
}
示例3: readAuthenticationMechanism
/**
* @param data
* @throws IdentityProviderException
*/
@Override
protected void readAuthenticationMechanism(RahasData data) throws IdentityProviderException {
MessageContext inContext = null;
Vector results = null;
if (log.isDebugEnabled()) {
log.debug("Reading authentication mechanism");
}
inContext = data.getInMessageContext();
if ((results = (Vector) inContext.getProperty(WSHandlerConstants.RECV_RESULTS)) == null) {
log.error("Missing authentication mechanism");
throw new IdentityProviderException("Missing authentication mechanism");
} else {
for (int i = 0; i < results.size(); i++) {
WSHandlerResult rResult = (WSHandlerResult) results.get(i);
Vector wsSecEngineResults = rResult.getResults();
for (int j = 0; j < wsSecEngineResults.size(); j++) {
WSSecurityEngineResult wser = (WSSecurityEngineResult) wsSecEngineResults.get(j);
int action = ((Integer) wser.get(WSSecurityEngineResult.TAG_ACTION)).intValue();
if (action == WSConstants.ST_UNSIGNED) {
this.authMechanism = IdentityConstants.AUTH_TYPE_SELF_ISSUED;
this.assertion = (SAMLAssertion) wser.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
} else if (action == WSConstants.UT && wser.get(WSSecurityEngineResult.TAG_PRINCIPAL) != null) {
this.authMechanism = IdentityConstants.AUTH_TYPE_USERNAME_TOKEN;
}
}
}
}
}
示例4: decodeAction
public static int decodeAction(String action, Vector actions) throws WSSecurityException {
int doAction = 0;
if (action == null) {
return doAction;
}
String single[] = StringUtil.split(action, ' ');
for (int i = 0; i < single.length; i++) {
if (single[i].equals(WSHandlerConstants.NO_SECURITY)) {
doAction = WSConstants.NO_SECURITY;
return doAction;
} else if (single[i].equals(WSHandlerConstants.USERNAME_TOKEN)) {
doAction |= WSConstants.UT;
actions.add(new Integer(WSConstants.UT));
} else if (single[i].equals(WSHandlerConstants.SIGNATURE)) {
doAction |= WSConstants.SIGN;
actions.add(new Integer(WSConstants.SIGN));
} else if (single[i].equals(WSHandlerConstants.ENCRYPT)) {
doAction |= WSConstants.ENCR;
actions.add(new Integer(WSConstants.ENCR));
} else if (single[i].equals(WSHandlerConstants.SAML_TOKEN_UNSIGNED)) {
doAction |= WSConstants.ST_UNSIGNED;
actions.add(new Integer(WSConstants.ST_UNSIGNED));
} else if (single[i].equals(WSHandlerConstants.SAML_TOKEN_SIGNED)) {
doAction |= WSConstants.ST_SIGNED;
actions.add(new Integer(WSConstants.ST_SIGNED));
} else if (single[i].equals(WSHandlerConstants.TIMESTAMP)) {
doAction |= WSConstants.TS;
actions.add(new Integer(WSConstants.TS));
} else if (single[i].equals(WSHandlerConstants.NO_SERIALIZATION)) {
doAction |= WSConstants.NO_SERIALIZE;
actions.add(new Integer(WSConstants.NO_SERIALIZE));
} else if (single[i].equals(WSHandlerConstants.SIGN_WITH_UT_KEY)) {
doAction |= WSConstants.UT_SIGN;
actions.add(new Integer(WSConstants.UT_SIGN));
} else if (single[i].equals(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION)) {
doAction |= WSConstants.SC;
actions.add(new Integer(WSConstants.SC));
} else {
throw new WSSecurityException(
"Unknown action defined: " + single[i]
);
}
}
return doAction;
}