本文整理汇总了Java中javax.security.auth.message.AuthException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java AuthException.getMessage方法的具体用法?Java AuthException.getMessage怎么用?Java AuthException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.security.auth.message.AuthException
的用法示例。
在下文中一共展示了AuthException.getMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: secureResponse
import javax.security.auth.message.AuthException; //导入方法依赖的package包/类
public void secureResponse(SoapMessage message)
{
SOAPMessage request = message.getExchange().getInMessage().get(SOAPMessage.class);
SOAPMessage response = message.getContent(SOAPMessage.class);
MessageInfo messageInfo = new GenericMessageInfo(request, response);
AuthStatus authStatus = null;
try
{
authStatus = sctx.secureResponse(messageInfo, null);
}
catch (AuthException e)
{
if (isSOAP12(message))
{
SoapFault soap12Fault = new SoapFault(e.getMessage(), Soap12.getInstance().getReceiver());
throw soap12Fault;
}
else
{
throw new SoapFault(e.getMessage(), new QName("", "jaspi AuthException"));
}
}
if (messageInfo.getResponseMessage() != null && !message.getExchange().isOneWay())
{
if (AuthStatus.SEND_CONTINUE == authStatus)
{
message.put(Message.RESPONSE_CODE, Integer.valueOf(303));
}
if (AuthStatus.SEND_FAILURE == authStatus)
{
message.put(Message.RESPONSE_CODE, Integer.valueOf(500));
}
}
}
示例2: secureRequest
import javax.security.auth.message.AuthException; //导入方法依赖的package包/类
public void secureRequest(SoapMessage message)
{
SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
MessageInfo messageInfo = new GenericMessageInfo(soapMessage, null);
String authContextID = clientConfig.getAuthContextID(messageInfo);
Properties serverContextProperties = new Properties();
serverContextProperties.put("security-domain", securityDomain);
serverContextProperties.put("jaspi-policy", jpi);
Subject clientSubject = new Subject();
@SuppressWarnings("unused")
AuthStatus authStatus = null;
try
{
ClientAuthContext cctx = clientConfig.getAuthContext(authContextID, clientSubject, serverContextProperties);
authStatus = cctx.secureRequest(messageInfo, clientSubject);
}
catch (AuthException e)
{
if (isSOAP12(message))
{
SoapFault soap12Fault = new SoapFault(e.getMessage(), Soap12.getInstance().getSender());
throw soap12Fault;
}
else
{
throw new SoapFault(e.getMessage(), new QName("", "japsi AuthException"));
}
}
//TODO:look at how to handle AuthStatus
}
示例3: validateResponse
import javax.security.auth.message.AuthException; //导入方法依赖的package包/类
public void validateResponse(SoapMessage message)
{
SOAPMessage request = message.getExchange().getInMessage().get(SOAPMessage.class);
SOAPMessage response = message.getContent(SOAPMessage.class);
MessageInfo messageInfo = new GenericMessageInfo(request, response);
String authContextID = clientConfig.getAuthContextID(messageInfo);
Properties serverContextProperties = new Properties();
serverContextProperties.put("security-domain", securityDomain);
serverContextProperties.put("jaspi-policy", jpi);
Subject clientSubject = new Subject();
@SuppressWarnings("unused")
AuthStatus authStatus = null;
try
{
ClientAuthContext sctx = clientConfig.getAuthContext(authContextID, clientSubject, serverContextProperties);
authStatus = sctx.validateResponse(messageInfo, new Subject(), new Subject());
}
catch (AuthException e)
{
if (isSOAP12(message))
{
SoapFault soap12Fault = new SoapFault(e.getMessage(), Soap12.getInstance().getSender());
throw soap12Fault;
}
else
{
throw new SoapFault(e.getMessage(), new QName("", "japsi AuthException"));
}
}
//TODO:handle AuthStatus
}