本文整理汇总了Java中org.apache.cxf.interceptor.security.AccessDeniedException类的典型用法代码示例。如果您正苦于以下问题:Java AccessDeniedException类的具体用法?Java AccessDeniedException怎么用?Java AccessDeniedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AccessDeniedException类属于org.apache.cxf.interceptor.security包,在下文中一共展示了AccessDeniedException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getTargetMethod
import org.apache.cxf.interceptor.security.AccessDeniedException; //导入依赖的package包/类
protected Method getTargetMethod(Message m) {
// Used the SOAP
BindingOperationInfo bop = m.getExchange().get(BindingOperationInfo.class);
if (bop != null) {
MethodDispatcher md = (MethodDispatcher)
m.getExchange().get(Service.class).get(MethodDispatcher.class.getName());
return md.getMethod(bop);
}
// Used for JAX-RS
// This doesn't work for JAX-RS sub-resources as the lookup is only done on the original method, not the
// sub-resource
Method method = (Method) m.get("org.apache.cxf.resource.method");
if (method != null) {
return method;
}
throw new AccessDeniedException("Method is not available : Unauthorized");
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:18,代码来源:NetworkAddressValidatingInterceptor.java
示例2: handleMessage
import org.apache.cxf.interceptor.security.AccessDeniedException; //导入依赖的package包/类
public void handleMessage(Message message) throws Fault
{
SecurityContext sc = message.get(SecurityContext.class);
if (sc == null)
{
return;
}
Method method = getTargetMethod(message);
if (authorize(sc, method))
{
return;
}
throw new AccessDeniedException("Unauthorized");
}
开发者ID:geoserver,项目名称:geofence,代码行数:18,代码来源:AuthorizationHandler.java
示例3: getTargetMethod
import org.apache.cxf.interceptor.security.AccessDeniedException; //导入依赖的package包/类
protected Method getTargetMethod(Message m)
{
BindingOperationInfo bop = m.getExchange().get(BindingOperationInfo.class);
if (bop != null)
{
MethodDispatcher md = (MethodDispatcher) m.getExchange().get(Service.class).get(MethodDispatcher.class.getName());
return md.getMethod(bop);
}
Method method = (Method) m.get("org.apache.cxf.resource.method");
if (method != null)
{
return method;
}
throw new AccessDeniedException("Method is not available : Unauthorized");
}
开发者ID:geoserver,项目名称:geofence,代码行数:18,代码来源:AuthorizationHandler.java
示例4: getTargetMethod
import org.apache.cxf.interceptor.security.AccessDeniedException; //导入依赖的package包/类
/**
* Here we are getting the target invocation method. The method get set as a
* properties in the
* message by the
* {@link org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor}
*
* @param message incoming message
* @return
*/
protected Method getTargetMethod(Message message) {
BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
if (bop != null) {
MethodDispatcher md =
(MethodDispatcher) message.getExchange().get(Service.class)
.get(MethodDispatcher.class.getName());
return md.getMethod(bop);
}
Method method = (Method) message.get("org.apache.cxf.resource.method");
if (method != null) {
return method;
}
log.error("The requested resource is not found. Please check the resource path etc..");
throw new AccessDeniedException("Method is not available : Unauthorized");
}
开发者ID:apache,项目名称:stratos,代码行数:25,代码来源:StratosAuthorizingHandler.java
示例5: handleMessage
import org.apache.cxf.interceptor.security.AccessDeniedException; //导入依赖的package包/类
public void handleMessage( Message message ) throws Fault
{
Fault fault = (Fault) message.getContent( Exception.class );
Throwable ex = fault.getCause();
if ( !(ex instanceof SecurityException) )
{
throw new RuntimeException( "Security Exception is expected:" + ex );
}
HttpServletResponse response = (HttpServletResponse) message.getExchange().getInMessage()
.get( AbstractHTTPDestination.HTTP_RESPONSE );
int status = ex instanceof AccessDeniedException ? 403 : 401;
response.setStatus( status );
try
{
response.getOutputStream().write( ex.getMessage().getBytes() );
response.getOutputStream().flush();
}
catch ( IOException iex )
{
// ignore
}
message.getInterceptorChain().abort();
}
开发者ID:apache,项目名称:directory-fortress-enmasse,代码行数:28,代码来源:SecurityOutFaultInterceptor.java
示例6: handleMessage
import org.apache.cxf.interceptor.security.AccessDeniedException; //导入依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault {
try {
super.handleMessage(message);
} catch (AccessDeniedException fault) {
Fault unauthorized = new Fault("Unauthorized", getGlobal());
unauthorized.setStatusCode(403);
throw unauthorized;
}
}
开发者ID:kantega,项目名称:respiro,代码行数:14,代码来源:RespiroSecureAnnotationsInterceptor.java
示例7: getTargetMethod
import org.apache.cxf.interceptor.security.AccessDeniedException; //导入依赖的package包/类
/**
* Here we are getting the target invocation method. The method get set as a property in the
* message by the {@link org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor}
*
* @param message incoming message
* @return
*/
protected Method getTargetMethod(Message message) {
BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
if (bop != null) {
MethodDispatcher md = (MethodDispatcher)
message.getExchange().get(Service.class).get(MethodDispatcher.class.getName());
return md.getMethod(bop);
}
Method method = (Method) message.get("org.apache.cxf.resource.method");
if (method != null) {
return method;
}
log.error("The requested resource is not found. Please check the resource path, etc");
throw new AccessDeniedException("Method is not available: Unauthorized");
}
开发者ID:apache,项目名称:stratos,代码行数:22,代码来源:StratosAuthorizingHandler.java
注:本文中的org.apache.cxf.interceptor.security.AccessDeniedException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论