1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.wss4j.stax.impl.securityToken;
20
21 import java.security.Key;
22 import java.security.PublicKey;
23 import java.security.cert.X509Certificate;
24 import java.util.Deque;
25 import java.util.Map;
26
27 import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
28 import org.apache.wss4j.stax.securityToken.SecurityTokenReference;
29 import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
30 import org.apache.xml.security.exceptions.XMLSecurityException;
31 import org.apache.xml.security.stax.ext.XMLSecurityConstants;
32 import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
33 import org.apache.xml.security.stax.impl.securityToken.AbstractInboundSecurityToken;
34 import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
35
36 public class SecurityTokenReferenceImpl extends AbstractInboundSecurityToken implements SecurityTokenReference {
37
38 private final InboundSecurityToken inboundSecurityToken;
39 private final Deque<XMLSecEvent> xmlSecEvents;
40
41 public SecurityTokenReferenceImpl(InboundSecurityToken inboundSecurityToken, Deque<XMLSecEvent> xmlSecEvents,
42 WSInboundSecurityContext wsInboundSecurityContext, String id,
43 WSSecurityTokenConstants.KeyIdentifier keyIdentifier) {
44 super(wsInboundSecurityContext, id, keyIdentifier, true);
45 this.inboundSecurityToken = inboundSecurityToken;
46 this.xmlSecEvents = xmlSecEvents;
47 }
48
49 public Deque<XMLSecEvent> getXmlSecEvents() {
50 return xmlSecEvents;
51 }
52
53 @Override
54 public boolean isAsymmetric() throws XMLSecurityException {
55 return inboundSecurityToken.isAsymmetric();
56 }
57
58 @Override
59 public Map<String, Key> getSecretKey() throws XMLSecurityException {
60 return inboundSecurityToken.getSecretKey();
61 }
62
63 @Override
64 protected Key getKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage,
65 String correlationID) throws XMLSecurityException {
66 return inboundSecurityToken.getSecretKey(algorithmURI, algorithmUsage, correlationID);
67 }
68
69 @Override
70 public PublicKey getPublicKey() throws XMLSecurityException {
71 return inboundSecurityToken.getPublicKey();
72 }
73
74 @Override
75 protected PublicKey getPubKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage,
76 String correlationID) throws XMLSecurityException {
77 return inboundSecurityToken.getPublicKey(algorithmURI, algorithmUsage, correlationID);
78 }
79
80 @Override
81 public X509Certificate[] getX509Certificates() throws XMLSecurityException {
82 return inboundSecurityToken.getX509Certificates();
83 }
84
85 @Override
86 public void verify() throws XMLSecurityException {
87 inboundSecurityToken.verify();
88 }
89
90 @Override
91 public InboundSecurityToken getKeyWrappingToken() throws XMLSecurityException {
92 return (InboundSecurityToken)inboundSecurityToken.getKeyWrappingToken();
93 }
94
95 @Override
96 public boolean isIncludedInMessage() {
97 return inboundSecurityToken.isIncludedInMessage();
98 }
99
100 @Override
101 public WSSecurityTokenConstants.TokenType getTokenType() {
102 return inboundSecurityToken.getTokenType();
103 }
104 }