Methods Summary |
---|
private void | append(com.sun.xml.wss.impl.policy.SecurityPolicy xwssPolicy)Add Security policy.
effectivePolicyList.add(xwssPolicy);
|
private void | appendAfterToken(com.sun.xml.wss.impl.policy.SecurityPolicy xwssPolicy)Insert SecurityPolicy after supporting tokens.
int pos = -1;
for ( SecurityPolicy secPolicy : effectivePolicyList) {
if ( isSupportingToken(secPolicy) || isTimestamp(secPolicy)) {
continue;
} else {
pos = effectivePolicyList.indexOf(secPolicy);
break;
}
}
if ( pos != -1 ) {
effectivePolicyList.add(pos, xwssPolicy);
} else {
effectivePolicyList.add(xwssPolicy);
}
|
public void | convert()Convert WS-Security Policy to XWSS policy.
if ( MessageLayout.Lax == mode ) {
convertLax();
} else if ( MessageLayout.Strict == mode ) {
convertStrict();
} else if ( MessageLayout.LaxTsFirst == mode ) {
convertLaxTsFirst();
} else if ( MessageLayout.LaxTsLast == mode ) {
convertLaxTsLast();
}
|
private void | convertLax()Lax mode
for ( SecurityPolicy xwssPolicy : policyList ) {
if ( isTimestamp(xwssPolicy )) {
foundTimestamp = policyList.indexOf(xwssPolicy);
prepend(xwssPolicy);
continue;
}
if ( !isSupportingToken(xwssPolicy)) {
switch(section) {
case ClientIncomingPolicy:
prepend(xwssPolicy);
break;
case ClientOutgoingPolicy:
append(xwssPolicy);
break;
case ServerIncomingPolicy:
appendAfterToken(xwssPolicy);
break;
case ServerOutgoingPolicy:
append(xwssPolicy);
break;
}
} else if ( isSupportingToken(xwssPolicy) || isTimestamp(xwssPolicy)) {
prepend(xwssPolicy);
}
}
|
private void | convertLaxTsFirst()LaxTsFirst mode.
convertLax();
if ( foundTimestamp != -1 ) {
switch (section ) {
case ClientOutgoingPolicy:
effectivePolicyList.add(0, effectivePolicyList.remove(foundTimestamp));
break;
case ServerOutgoingPolicy:
effectivePolicyList.add(0, effectivePolicyList.remove(foundTimestamp));
break;
}
}
|
private void | convertLaxTsLast()LaxTsLast mode.
convertLax();
if ( foundTimestamp != -1 ) {
switch (section) {
case ClientOutgoingPolicy:
effectivePolicyList.add(effectivePolicyList.size() -1, effectivePolicyList.remove(foundTimestamp));
break;
case ServerOutgoingPolicy:
effectivePolicyList.add(effectivePolicyList.size() -1, effectivePolicyList.remove(foundTimestamp));
break;
}
}
|
private void | convertStrict()Strict mode.
for ( SecurityPolicy xwssPolicy : policyList ) {
if ( isSupportingToken(xwssPolicy)) {
prepend(xwssPolicy);
} else if ( isTimestamp(xwssPolicy)) {
prepend(xwssPolicy);
} else {
switch (section ) {
case ClientIncomingPolicy:
appendAfterToken(xwssPolicy);
break;
case ClientOutgoingPolicy:
append(xwssPolicy);
break;
case ServerIncomingPolicy:
appendAfterToken(xwssPolicy);
break;
case ServerOutgoingPolicy:
append(xwssPolicy);
break;
}
}
}
|
public com.sun.xml.wss.impl.policy.mls.MessagePolicy | getMessagePolicy()
if ( modified ) {
convert();
modified = false;
}
MessagePolicy msgPolicy = new MessagePolicy();
msgPolicy.appendAll(effectivePolicyList);
removeEmptyPrimaryPolicies(msgPolicy);
return msgPolicy;
|
public void | insert(com.sun.xml.wss.impl.policy.SecurityPolicy secPolicy)Insert into policyList
if(secPolicy == null){
return;
}
if ( policyList == null ) {
policyList = new ArrayList<SecurityPolicy>();
}
if ( isSupportingToken(secPolicy)) {
switch (section) {
case ServerOutgoingPolicy:
case ClientIncomingPolicy:
return;
}
}
modified = true;
policyList.add(secPolicy);
|
private boolean | isSupportingToken(com.sun.xml.wss.impl.policy.SecurityPolicy xwssPolicy)
if ( xwssPolicy == null ) {
return false;
}
//UsernameToken, SAML Token Policy, X509Certificate
if ( PolicyTypeUtil.authenticationTokenPolicy(xwssPolicy)) {
MLSPolicy binding = ((AuthenticationTokenPolicy)xwssPolicy).getFeatureBinding();
if ( PolicyTypeUtil.usernameTokenPolicy(binding) ||
PolicyTypeUtil.samlTokenPolicy(binding) ||
PolicyTypeUtil.x509CertificateBinding(binding)) {
return true;
}
}
return false;
|
private boolean | isTimestamp(com.sun.xml.wss.impl.policy.SecurityPolicy xwssPolicy)
if ( xwssPolicy != null && PolicyTypeUtil.timestampPolicy(xwssPolicy) ) {
return true;
}
return false;
|
private void | prepend(com.sun.xml.wss.impl.policy.SecurityPolicy xwssPolicy)Add SecurityPolicy.
effectivePolicyList.add(0, xwssPolicy);
|
private void | prependBeforeToken(com.sun.xml.wss.impl.policy.SecurityPolicy xwssPolicy)Insert SecurityPolicy before supporting Tokens.
int pos = -1;
for ( SecurityPolicy secPolicy : effectivePolicyList) {
if ( !isSupportingToken(secPolicy)) {
continue;
} else {
pos = effectivePolicyList.indexOf(secPolicy);
}
}
if ( pos != -1 ) {
effectivePolicyList.add(pos, xwssPolicy);
} else {
effectivePolicyList.add(xwssPolicy);
}
|
private void | removeEmptyPrimaryPolicies(com.sun.xml.wss.impl.policy.mls.MessagePolicy msgPolicy)
for ( Object policy : msgPolicy.getPrimaryPolicies() ) {
if ( policy instanceof SecurityPolicy) {
SecurityPolicy secPolicy = (SecurityPolicy)policy;
if ( PolicyTypeUtil.signaturePolicy(secPolicy)) {
if (((SignaturePolicy.FeatureBinding)((SignaturePolicy)secPolicy).getFeatureBinding()).getTargetBindings().size() == 0 ) {
msgPolicy.remove(secPolicy);
}
} else if ( PolicyTypeUtil.encryptionPolicy(secPolicy)) {
if (((EncryptionPolicy.FeatureBinding)((EncryptionPolicy)secPolicy).getFeatureBinding()).getTargetBindings().size() == 0 ) {
msgPolicy.remove(secPolicy);
}
}
}
}
|
public void | setMessageMode(boolean isServer, boolean isIncoming)
if ( isServer && isIncoming) {
section = Section.ServerIncomingPolicy;
} else if ( isServer && !isIncoming) {
section = Section.ServerOutgoingPolicy;
} else if ( !isServer && isIncoming) {
section = Section.ClientIncomingPolicy;
} else if ( !isServer && !isIncoming) {
section = Section.ClientOutgoingPolicy;
}
|
public void | setPolicyContainerMode(com.sun.xml.ws.security.policy.MessageLayout mode)
this.mode = mode;
|