gluu
公開メンバ関数 | 非公開メンバ関数 | 非公開変数類 | 全メンバ一覧
org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter クラス
org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter の継承関係図
Inheritance graph
org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter 連携図
Collaboration graph

公開メンバ関数

void filter (ContainerRequestContext requestContext) throws IOException
 

非公開メンバ関数

void init ()
 

非公開変数類

Logger log
 
ScimUmaProtectionService scimUmaProtectionService
 
HttpHeaders httpHeaders
 
ResourceInfo resourceInfo
 
WeldInstance< BaseUmaProtectionServiceprotectionServiceInstance
 
Map< String, Class< BaseUmaProtectionService > > protectionMapping
 

詳解

A RestEasy filter to centralize protection of APIs with UMA based on path pattern. Created by jgomer on 2017-11-25.

著者
Yuriy Movchan Date: 02/14/2017

関数詳解

◆ filter()

void org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter.filter ( ContainerRequestContext  requestContext) throws IOException
inline

This method performs the protection check of service invocations: it provokes returning an early error response if the underlying protection logic does not succeed, otherwise, makes the request flow to its destination service object

引数
requestContextThe ContainerRequestContext associated to filter execution
例外
IOExceptionIn practice no exception is thrown here. It's present to conform to interface implemented.
63  {
64 
65  String path=requestContext.getUriInfo().getPath();
66  //This is a path relative to the resteasy base URI (the application path marked with @ApplicationPath)
67 
68  log.trace("REST call to '{}' intercepted", path);
69  BaseUmaProtectionService protectionService=null;
70 
71  for (String prefix : protectionMapping.keySet()){
72  if (path.startsWith(prefix)){
73  protectionService=protectionServiceInstance.select(protectionMapping.get(prefix)).get();
74  break;
75  }
76  }
77 
78  if (protectionService==null){
79  log.warn("No concrete UMA protection mechanism is associated to this path (resource will be accessed anonymously)");
80  }
81  else{
82  log.info("Path is protected, proceeding with authorization processing...");
83 
84  Response authorizationResponse=protectionService.processAuthorization(httpHeaders, resourceInfo);
85  if (authorizationResponse == null)
86  log.info("Authorization passed"); //If authorization passed, proceed with actual processing of request
87  else
88  requestContext.abortWith(authorizationResponse);
89  }
90 
91  }
Logger log
Definition: AuthorizationProcessingFilter.java:40
WeldInstance< BaseUmaProtectionService > protectionServiceInstance
Definition: AuthorizationProcessingFilter.java:52
Map< String, Class< BaseUmaProtectionService > > protectionMapping
Definition: AuthorizationProcessingFilter.java:54
ResourceInfo resourceInfo
Definition: AuthorizationProcessingFilter.java:49
HttpHeaders httpHeaders
Definition: AuthorizationProcessingFilter.java:46

◆ init()

void org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter.init ( )
inlineprivate

Builds a map around url patterns and service beans that are aimed to perform actual protection

97  {
98  protectionMapping=new HashMap<String, Class<BaseUmaProtectionService>>();
99  for (WeldInstance.Handler<BaseUmaProtectionService> handler : protectionServiceInstance.handlers()){
100 
101  Class<BaseUmaProtectionService> beanClass = (Class<BaseUmaProtectionService>) handler.getBean().getBeanClass();
102  BindingUrls annotation=beanClass.getAnnotation(BindingUrls.class);
103  if (annotation!=null){
104  //annotation.value() is never null, at most, it's empty array
105  for (String pattern : annotation.value()){
106  if (pattern.length()>0) {
107  //pattern, can never be null
108  protectionMapping.put(pattern, beanClass);
109  //If two beans pretend to protect the same url, only the last in the list will take effect
110  }
111  }
112  }
113  }
114  }
WeldInstance< BaseUmaProtectionService > protectionServiceInstance
Definition: AuthorizationProcessingFilter.java:52
Map< String, Class< BaseUmaProtectionService > > protectionMapping
Definition: AuthorizationProcessingFilter.java:54

メンバ詳解

◆ httpHeaders

HttpHeaders org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter.httpHeaders
private

◆ log

Logger org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter.log
private

◆ protectionMapping

Map<String, Class<BaseUmaProtectionService> > org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter.protectionMapping
private

◆ protectionServiceInstance

WeldInstance<BaseUmaProtectionService> org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter.protectionServiceInstance
private

◆ resourceInfo

ResourceInfo org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter.resourceInfo
private

◆ scimUmaProtectionService

ScimUmaProtectionService org.gluu.oxtrust.service.filter.AuthorizationProcessingFilter.scimUmaProtectionService
private

このクラス詳解は次のファイルから抽出されました: