public Object doUsernameToken(SecurityProcessorContext spc) {
log.debug("Processing "
+ spc.readCurrentSecurityToken().getTokenName() + ": "
+ SecurityProcessorContext.ACTION_NAMES[spc.getAction()]);
SecurityPolicyToken spt = spc.readCurrentSecurityToken();
switch (spc.getAction()) {
case SecurityProcessorContext.START:
if (!initializedUsernameToken) {
try {
initializeUsernameToken(spt);
UsernameToken unt = (UsernameToken)spc.readCurrentPolicyEngineData();
//Get the includeToken attr info
String includetokenUri = spc.getAssertion().getAttribute(
new QName(Constants.SP_NS,
Constants.ATTR_INCLUDE_TOKEN));
try {
if(includetokenUri != null) { //since its optional
unt.setInclusion(includetokenUri);
}
((TokenWrapper)spc.readPreviousPolicyEngineData()).setToken(unt);
} catch (WSSPolicyException e) {
log.error(e.getMessage(), e);
return new Boolean(false);
}
initializedUsernameToken = true;
} catch (NoSuchMethodException e) {
log.error(e.getMessage(), e);
return new Boolean(false);
}
}
log.debug(spt.getTokenName());
PrimitiveAssertion pa = spc.getAssertion();
String text = pa.getStrValue();
if (text != null) {
text = text.trim();
log.debug("Value: '" + text.toString() + "'");