use of org.apache.wss4j.policy.model.HttpsToken in project cxf by apache.
the class AbstractCommonBindingHandler method assertToken.
protected void assertToken(AbstractToken token) {
if (token == null) {
return;
}
assertPolicy(token.getName());
String namespace = token.getName().getNamespaceURI();
if (token.getDerivedKeys() != null) {
assertPolicy(new QName(namespace, token.getDerivedKeys().name()));
}
if (token instanceof X509Token) {
X509Token x509Token = (X509Token) token;
assertX509Token(x509Token);
} else if (token instanceof HttpsToken) {
HttpsToken httpsToken = (HttpsToken) token;
if (httpsToken.getAuthenticationType() != null) {
assertPolicy(new QName(namespace, httpsToken.getAuthenticationType().name()));
}
} else if (token instanceof KeyValueToken) {
KeyValueToken keyValueToken = (KeyValueToken) token;
if (keyValueToken.isRsaKeyValue()) {
assertPolicy(new QName(namespace, SPConstants.RSA_KEY_VALUE));
}
} else if (token instanceof UsernameToken) {
UsernameToken usernameToken = (UsernameToken) token;
assertUsernameToken(usernameToken);
} else if (token instanceof SecureConversationToken) {
SecureConversationToken scToken = (SecureConversationToken) token;
assertSecureConversationToken(scToken);
} else if (token instanceof SecurityContextToken) {
SecurityContextToken scToken = (SecurityContextToken) token;
assertSecurityContextToken(scToken);
} else if (token instanceof SpnegoContextToken) {
SpnegoContextToken scToken = (SpnegoContextToken) token;
assertSpnegoContextToken(scToken);
} else if (token instanceof IssuedToken) {
IssuedToken issuedToken = (IssuedToken) token;
assertIssuedToken(issuedToken);
} else if (token instanceof KerberosToken) {
KerberosToken kerberosToken = (KerberosToken) token;
assertKerberosToken(kerberosToken);
} else if (token instanceof SamlToken) {
SamlToken samlToken = (SamlToken) token;
assertSamlToken(samlToken);
}
}
use of org.apache.wss4j.policy.model.HttpsToken in project tesb-rt-se by Talend.
the class SingleBusLocatorRegistrar method isSecuredByPolicy.
/**
* Is the transport secured by a policy
*/
private boolean isSecuredByPolicy(Server server) {
boolean isSecured = false;
EndpointInfo ei = server.getEndpoint().getEndpointInfo();
PolicyEngine pe = bus.getExtension(PolicyEngine.class);
if (null == pe) {
LOG.finest("No Policy engine found");
return isSecured;
}
Destination destination = server.getDestination();
EndpointPolicy ep = pe.getServerEndpointPolicy(ei, destination, null);
Collection<Assertion> assertions = ep.getChosenAlternative();
for (Assertion a : assertions) {
if (a instanceof TransportBinding) {
TransportBinding tb = (TransportBinding) a;
TransportToken tt = tb.getTransportToken();
AbstractToken t = tt.getToken();
if (t instanceof HttpsToken) {
isSecured = true;
break;
}
}
}
Policy policy = ep.getPolicy();
List<PolicyComponent> pcList = policy.getPolicyComponents();
for (PolicyComponent a : pcList) {
if (a instanceof TransportBinding) {
TransportBinding tb = (TransportBinding) a;
TransportToken tt = tb.getTransportToken();
AbstractToken t = tt.getToken();
if (t instanceof HttpsToken) {
isSecured = true;
break;
}
}
}
return isSecured;
}
Aggregations