org.apache.cxf.ws.security.wss4j
Class UsernameTokenInterceptor
java.lang.Object
org.apache.cxf.phase.AbstractPhaseInterceptor<SoapMessage>
org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor
org.apache.cxf.ws.security.wss4j.UsernameTokenInterceptor
- All Implemented Interfaces:
- SoapInterceptor, Interceptor<SoapMessage>, PhaseInterceptor<SoapMessage>
public class UsernameTokenInterceptor
- extends AbstractSoapInterceptor
Method Summary |
protected org.apache.ws.security.message.WSSecUsernameToken |
addUsernameToken(SoapMessage message,
UsernameToken token)
|
protected SecurityContext |
createSecurityContext(Principal p,
Subject subject)
|
protected Subject |
createSubject(String name,
String password,
boolean isDigest,
String nonce,
String created)
Create a Subject representing a current user and its roles. |
String |
getPassword(String userName,
UsernameToken info,
int type,
SoapMessage message)
|
protected org.apache.ws.security.WSUsernameTokenPrincipal |
getPrincipal(Element tokenElement,
SoapMessage message)
|
Set<QName> |
getUnderstoodHeaders()
|
void |
handleMessage(SoapMessage message)
Intercepts a message. |
protected org.apache.ws.security.WSUsernameTokenPrincipal |
parseTokenAndCreatePrincipal(Element tokenElement)
|
protected void |
policyNotAsserted(UsernameToken assertion,
Exception reason,
SoapMessage message)
|
protected void |
policyNotAsserted(UsernameToken assertion,
String reason,
SoapMessage message)
|
Methods inherited from class org.apache.cxf.phase.AbstractPhaseInterceptor |
addAfter, addAfter, addBefore, addBefore, getAdditionalInterceptors, getAfter, getBefore, getId, getPhase, handleFault, isGET, isRequestor, setAfter, setBefore |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UsernameTokenInterceptor
public UsernameTokenInterceptor()
- Parameters:
p
-
getUnderstoodHeaders
public Set<QName> getUnderstoodHeaders()
- Specified by:
getUnderstoodHeaders
in interface SoapInterceptor
- Overrides:
getUnderstoodHeaders
in class AbstractSoapInterceptor
handleMessage
public void handleMessage(SoapMessage message)
throws Fault
- Description copied from interface:
Interceptor
- Intercepts a message.
Interceptors should NOT invoke handleMessage or handleFault
on the next interceptor - the interceptor chain will
take care of this.
- Throws:
Fault
getPrincipal
protected org.apache.ws.security.WSUsernameTokenPrincipal getPrincipal(Element tokenElement,
SoapMessage message)
throws org.apache.ws.security.WSSecurityException
- Throws:
org.apache.ws.security.WSSecurityException
parseTokenAndCreatePrincipal
protected org.apache.ws.security.WSUsernameTokenPrincipal parseTokenAndCreatePrincipal(Element tokenElement)
throws org.apache.ws.security.WSSecurityException
- Throws:
org.apache.ws.security.WSSecurityException
createSecurityContext
protected SecurityContext createSecurityContext(Principal p,
Subject subject)
createSubject
protected Subject createSubject(String name,
String password,
boolean isDigest,
String nonce,
String created)
throws SecurityException
- Create a Subject representing a current user and its roles.
This Subject is expected to contain at least one Principal representing a user
and optionally followed by one or more principal Groups this user is a member of.
- Parameters:
name
- usernamepassword
- passwordisDigest
- true if a password digest is usednonce
- optional noncecreated
- optional timestamp
- Returns:
- subject
- Throws:
SecurityException
addUsernameToken
protected org.apache.ws.security.message.WSSecUsernameToken addUsernameToken(SoapMessage message,
UsernameToken token)
getPassword
public String getPassword(String userName,
UsernameToken info,
int type,
SoapMessage message)
policyNotAsserted
protected void policyNotAsserted(UsernameToken assertion,
String reason,
SoapMessage message)
policyNotAsserted
protected void policyNotAsserted(UsernameToken assertion,
Exception reason,
SoapMessage message)
Apache CXF