targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() { ); if (sourceSender) { targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() { ); } else if (sourceContent) { targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() { targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() { ); } else if (sourceContent) { targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() { targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() {
targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() { ); if (sourceSender) { targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() { ); } else if (sourceContent) { targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() { targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() { ); } else if (sourceContent) { targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() { targetPolicies.add(new TargetPolicy(null, new ProtectionPolicy() { public String getID() {
public AuthPolicy(MessagePolicy messagePolicy) { if (messagePolicy != null) { TargetPolicy[] targetPolicies = messagePolicy.getTargetPolicies(); if (targetPolicies != null && targetPolicies.length > 0) { int contentInd = -1; int recipientInd = -1; for (int i = 0; i < targetPolicies.length; i++) { ProtectionPolicy pp = targetPolicies[i].getProtectionPolicy(); if (ProtectionPolicy.AUTHENTICATE_RECIPIENT.equals( pp.getID())) { recipientInd = i; this.authenticateRecipient = true; } else if (ProtectionPolicy.AUTHENTICATE_SENDER.equals( pp.getID())) { contentInd = i; setAuthenticationType(SOURCE_AUTH_SENDER); } else if (ProtectionPolicy.AUTHENTICATE_CONTENT.equals( pp.getID())) { contentInd = i; setAuthenticationType(SOURCE_AUTH_CONTENT); } } if (authenticateRecipient && contentInd >= 0) { this.recipientBeforeContent = (recipientInd < contentInd); } } } }
public AuthPolicy(MessagePolicy messagePolicy) { if (messagePolicy != null) { TargetPolicy[] targetPolicies = messagePolicy.getTargetPolicies(); if (targetPolicies != null && targetPolicies.length > 0) { int contentInd = -1; int recipientInd = -1; for (int i = 0; i < targetPolicies.length; i++) { ProtectionPolicy pp = targetPolicies[i].getProtectionPolicy(); if (ProtectionPolicy.AUTHENTICATE_RECIPIENT.equals( pp.getID())) { recipientInd = i; this.authenticateRecipient = true; } else if (ProtectionPolicy.AUTHENTICATE_SENDER.equals( pp.getID())) { contentInd = i; setAuthenticationType(SOURCE_AUTH_SENDER); } else if (ProtectionPolicy.AUTHENTICATE_CONTENT.equals( pp.getID())) { contentInd = i; setAuthenticationType(SOURCE_AUTH_CONTENT); } } if (authenticateRecipient && contentInd >= 0) { this.recipientBeforeContent = (recipientInd < contentInd); } } } }
private static MessagePolicy.TargetPolicy newTargetPolicy(TargetPolicyType targetPolicyType) throws AuthException { MessagePolicy.Target[] targets = new MessagePolicy.Target[targetPolicyType.getTarget().size()]; int i = 0; for (TargetType targetType: targetPolicyType.getTarget()) { targets[i++] = newTarget(targetType); } return new MessagePolicy.TargetPolicy(targets, newProtectionPolicy(targetPolicyType.getProtectionPolicy())); }