gluu
公開メンバ関数 | 非公開メンバ関数 | 静的非公開メンバ関数 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.xdi.oxauth.service.ScopeService クラス
org.xdi.oxauth.service.ScopeService 連携図
Collaboration graph

公開メンバ関数

List< org.xdi.oxauth.model.common.ScopegetAllScopesList ()
 
List< String > getDefaultScopesDn ()
 
List< String > getScopesDn (List< String > scopeNames)
 
org.xdi.oxauth.model.common.Scope getScopeByDn (String dn)
 
org.xdi.oxauth.model.common.Scope getScopeByDnSilently (String dn)
 
org.xdi.oxauth.model.common.Scope getScopeByDisplayName (String displayName)
 
List< org.xdi.oxauth.model.common.ScopegetScopeByClaim (String claimDn)
 
List< org.xdi.oxauth.model.common.ScopegetScopesByClaim (List< org.xdi.oxauth.model.common.Scope > scopes, String claimDn)
 

非公開メンバ関数

void putInCache (org.xdi.oxauth.model.common.Scope scope)
 
void putInCache (String claimDn, List< org.xdi.oxauth.model.common.Scope > scopes)
 
org.xdi.oxauth.model.common.Scope fromCacheByDn (String dn)
 
org.xdi.oxauth.model.common.Scope fromCacheByName (String name)
 
List< org.xdi.oxauth.model.common.ScopefromCacheByClaimDn (String claimDn)
 

静的非公開メンバ関数

static String getClaimDnCacheKey (String claimDn)
 
static String getScopeNameCacheKey (String name)
 
static String getScopeDnCacheKey (String dn)
 

非公開変数類

Logger log
 
CacheService cacheService
 
PersistenceEntryManager ldapEntryManager
 
StaticConfiguration staticConfiguration
 

静的非公開変数類

static final String CACHE_SCOPE_NAME = "ScopeCache"
 

詳解

著者
Javier Rojas Blum Date: 07.05.2012
Yuriy Movchan Date: 2016/04/26

関数詳解

◆ fromCacheByClaimDn()

List<org.xdi.oxauth.model.common.Scope> org.xdi.oxauth.service.ScopeService.fromCacheByClaimDn ( String  claimDn)
inlineprivate
217  {
218  try {
219  String key = getClaimDnCacheKey(claimDn);
220  return (List<org.xdi.oxauth.model.common.Scope>) cacheService.get(CACHE_SCOPE_NAME, key);
221  } catch (Exception ex) {
222  log.error("Failed to get scopes from cache, claimDn: '{}'", claimDn, ex);
223  return null;
224  }
225  }
static final String CACHE_SCOPE_NAME
Definition: ScopeService.java:32
static String getClaimDnCacheKey(String claimDn)
Definition: ScopeService.java:227
CacheService cacheService
Definition: ScopeService.java:38
Logger log
Definition: ScopeService.java:35

◆ fromCacheByDn()

org.xdi.oxauth.model.common.Scope org.xdi.oxauth.service.ScopeService.fromCacheByDn ( String  dn)
inlineprivate
197  {
198  try {
199  String key = getScopeDnCacheKey(dn);
201  } catch (Exception ex) {
202  log.error("Failed to get scope from cache, scopeDn: '{}'", dn, ex);
203  return null;
204  }
205  }
static final String CACHE_SCOPE_NAME
Definition: ScopeService.java:32
CacheService cacheService
Definition: ScopeService.java:38
Logger log
Definition: ScopeService.java:35
Definition: Scope.java:23
static String getScopeDnCacheKey(String dn)
Definition: ScopeService.java:235
Definition: AuthenticationMethod.java:7

◆ fromCacheByName()

org.xdi.oxauth.model.common.Scope org.xdi.oxauth.service.ScopeService.fromCacheByName ( String  name)
inlineprivate
207  {
208  try {
209  String key = getScopeNameCacheKey(name);
211  } catch (Exception ex) {
212  log.error("Failed to get scope from cache, name: '{}'", name, ex);
213  return null;
214  }
215  }
static final String CACHE_SCOPE_NAME
Definition: ScopeService.java:32
static String getScopeNameCacheKey(String name)
Definition: ScopeService.java:231
CacheService cacheService
Definition: ScopeService.java:38
Logger log
Definition: ScopeService.java:35
Definition: Scope.java:23
Definition: AuthenticationMethod.java:7

◆ getAllScopesList()

List<org.xdi.oxauth.model.common.Scope> org.xdi.oxauth.service.ScopeService.getAllScopesList ( )
inline

returns a list of all scopes

戻り値
list of scopes
51  {
52  String scopesBaseDN = staticConfiguration.getBaseDn().getScopes();
53 
54  return ldapEntryManager.findEntries(scopesBaseDN,
56  Filter.createPresenceFilter("inum"));
57  }
PersistenceEntryManager ldapEntryManager
Definition: ScopeService.java:41
Definition: Scope.java:23
String getScopes()
Definition: BaseDnConfiguration.java:117
StaticConfiguration staticConfiguration
Definition: ScopeService.java:44
Definition: AuthenticationMethod.java:7
BaseDnConfiguration getBaseDn()
Definition: StaticConfiguration.java:32

◆ getClaimDnCacheKey()

static String org.xdi.oxauth.service.ScopeService.getClaimDnCacheKey ( String  claimDn)
inlinestaticprivate
227  {
228  return "claim_dn" + StringHelper.toLowerCase(claimDn);
229  }

◆ getDefaultScopesDn()

List<String> org.xdi.oxauth.service.ScopeService.getDefaultScopesDn ( )
inline
59  {
60  List<String> defaultScopes = new ArrayList<String>();
61 
62  for (org.xdi.oxauth.model.common.Scope scope : getAllScopesList()) {
63  if (scope.getIsDefault()) {
64  defaultScopes.add(scope.getDn());
65  }
66  }
67 
68  return defaultScopes;
69  }
List< org.xdi.oxauth.model.common.Scope > getAllScopesList()
Definition: ScopeService.java:51
Definition: Scope.java:23
Definition: AuthenticationMethod.java:7

◆ getScopeByClaim()

List<org.xdi.oxauth.model.common.Scope> org.xdi.oxauth.service.ScopeService.getScopeByClaim ( String  claimDn)
inline

Get scope by oxAuthClaims

引数
oxAuthClaim
戻り値
List of scope
145  {
146  List<org.xdi.oxauth.model.common.Scope> scopes = fromCacheByClaimDn(claimDn);
147  if (scopes == null) {
148  Filter filter = Filter.createEqualityFilter("oxAuthClaim", claimDn);
149 
150  String scopesBaseDN = staticConfiguration.getBaseDn().getScopes();
151  scopes = ldapEntryManager.findEntries(scopesBaseDN, org.xdi.oxauth.model.common.Scope.class, filter);
152 
153  putInCache(claimDn, scopes);
154  }
155 
156  return scopes;
157  }
List< org.xdi.oxauth.model.common.Scope > fromCacheByClaimDn(String claimDn)
Definition: ScopeService.java:217
PersistenceEntryManager ldapEntryManager
Definition: ScopeService.java:41
Definition: Scope.java:23
void putInCache(org.xdi.oxauth.model.common.Scope scope)
Definition: ScopeService.java:172
String getScopes()
Definition: BaseDnConfiguration.java:117
StaticConfiguration staticConfiguration
Definition: ScopeService.java:44
Definition: AuthenticationMethod.java:7
BaseDnConfiguration getBaseDn()
Definition: StaticConfiguration.java:32

◆ getScopeByDisplayName()

org.xdi.oxauth.model.common.Scope org.xdi.oxauth.service.ScopeService.getScopeByDisplayName ( String  displayName)
inline

Get scope by DisplayName

引数
DisplayName
戻り値
scope
119  {
120  org.xdi.oxauth.model.common.Scope scope = fromCacheByName(displayName);
121  if (scope == null) {
122  String scopesBaseDN = staticConfiguration.getBaseDn().getScopes();
123 
124  org.xdi.oxauth.model.common.Scope scopeExample = new org.xdi.oxauth.model.common.Scope();
125  scopeExample.setDn(scopesBaseDN);
126  scopeExample.setDisplayName(displayName);
127 
128  List<org.xdi.oxauth.model.common.Scope> scopes = ldapEntryManager.findEntries(scopeExample);
129  if ((scopes != null) && (scopes.size() > 0)) {
130  scope = scopes.get(0);
131  }
132 
133  putInCache(scope);
134  }
135 
136  return scope;
137  }
void setDn(String dn)
Definition: Scope.java:60
PersistenceEntryManager ldapEntryManager
Definition: ScopeService.java:41
Definition: Scope.java:23
void putInCache(org.xdi.oxauth.model.common.Scope scope)
Definition: ScopeService.java:172
String getScopes()
Definition: BaseDnConfiguration.java:117
StaticConfiguration staticConfiguration
Definition: ScopeService.java:44
Definition: AuthenticationMethod.java:7
BaseDnConfiguration getBaseDn()
Definition: StaticConfiguration.java:32
org.xdi.oxauth.model.common.Scope fromCacheByName(String name)
Definition: ScopeService.java:207

◆ getScopeByDn()

org.xdi.oxauth.model.common.Scope org.xdi.oxauth.service.ScopeService.getScopeByDn ( String  dn)
inline

returns Scope by Dn

戻り値
Scope
89  {
91  if (scope == null) {
92  scope = ldapEntryManager.find(org.xdi.oxauth.model.common.Scope.class, dn);
93  putInCache(scope);
94  }
95 
96  return scope;
97  }
PersistenceEntryManager ldapEntryManager
Definition: ScopeService.java:41
Definition: Scope.java:23
void putInCache(org.xdi.oxauth.model.common.Scope scope)
Definition: ScopeService.java:172
org.xdi.oxauth.model.common.Scope fromCacheByDn(String dn)
Definition: ScopeService.java:197
Definition: AuthenticationMethod.java:7

◆ getScopeByDnSilently()

org.xdi.oxauth.model.common.Scope org.xdi.oxauth.service.ScopeService.getScopeByDnSilently ( String  dn)
inline

returns Scope by Dn

戻り値
Scope
104  {
105  try {
106  return getScopeByDn(dn);
107  } catch (Exception e) {
108  log.trace(e.getMessage(), e);
109  return null;
110  }
111  }
org.xdi.oxauth.model.common.Scope getScopeByDn(String dn)
Definition: ScopeService.java:89
Logger log
Definition: ScopeService.java:35

◆ getScopeDnCacheKey()

static String org.xdi.oxauth.service.ScopeService.getScopeDnCacheKey ( String  dn)
inlinestaticprivate
235  {
236  return "scope_dn_" + StringHelper.toLowerCase(dn);
237  }

◆ getScopeNameCacheKey()

static String org.xdi.oxauth.service.ScopeService.getScopeNameCacheKey ( String  name)
inlinestaticprivate
231  {
232  return "scope_name_" + StringHelper.toLowerCase(name);
233  }

◆ getScopesByClaim()

List<org.xdi.oxauth.model.common.Scope> org.xdi.oxauth.service.ScopeService.getScopesByClaim ( List< org.xdi.oxauth.model.common.Scope scopes,
String  claimDn 
)
inline
159  {
160  List<org.xdi.oxauth.model.common.Scope> result = new ArrayList<org.xdi.oxauth.model.common.Scope>();
161  for (org.xdi.oxauth.model.common.Scope scope : scopes) {
162  List<String> claims = scope.getOxAuthClaims();
163  if ((claims != null) && claims.contains(claimDn)) {
164  result.add(scope);
165  }
166 
167  }
168 
169  return result;
170  }
Definition: Scope.java:23
List< String > getOxAuthClaims()
Definition: Scope.java:96
Definition: AuthenticationMethod.java:7

◆ getScopesDn()

List<String> org.xdi.oxauth.service.ScopeService.getScopesDn ( List< String >  scopeNames)
inline
71  {
72  List<String> scopes = new ArrayList<String>();
73 
74  for (String scopeName : scopeNames) {
76  if (scope != null) {
77  scopes.add(scope.getDn());
78  }
79  }
80 
81  return scopes;
82  }
org.xdi.oxauth.model.common.Scope getScopeByDisplayName(String displayName)
Definition: ScopeService.java:119
Definition: Scope.java:23
Definition: AuthenticationMethod.java:7

◆ putInCache() [1/2]

void org.xdi.oxauth.service.ScopeService.putInCache ( org.xdi.oxauth.model.common.Scope  scope)
inlineprivate
172  {
173  if (scope == null) {
174  return;
175  }
176 
177  try {
178  cacheService.put(CACHE_SCOPE_NAME, getScopeNameCacheKey(scope.getDisplayName()), scope, Constants.SKIP_CACHE_PUT_FOR_NATIVE_PERSISTENCE);
179  cacheService.put(CACHE_SCOPE_NAME, getScopeDnCacheKey(scope.getDn()), scope, Constants.SKIP_CACHE_PUT_FOR_NATIVE_PERSISTENCE);
180  } catch (Exception ex) {
181  log.error("Failed to put scope in cache, scope: '{}'", scope, ex);
182  }
183  }
static final String CACHE_SCOPE_NAME
Definition: ScopeService.java:32
static String getScopeNameCacheKey(String name)
Definition: ScopeService.java:231
CacheService cacheService
Definition: ScopeService.java:38
Logger log
Definition: ScopeService.java:35
static String getScopeDnCacheKey(String dn)
Definition: ScopeService.java:235

◆ putInCache() [2/2]

void org.xdi.oxauth.service.ScopeService.putInCache ( String  claimDn,
List< org.xdi.oxauth.model.common.Scope scopes 
)
inlineprivate
184  {
185  if (scopes == null) {
186  return;
187  }
188 
189  try {
190  String key = getClaimDnCacheKey(claimDn);
191  cacheService.put(CACHE_SCOPE_NAME, key, scopes);
192  } catch (Exception ex) {
193  log.error("Failed to put scopes in cache, claimDn: '{}'", claimDn, ex);
194  }
195  }
static final String CACHE_SCOPE_NAME
Definition: ScopeService.java:32
static String getClaimDnCacheKey(String claimDn)
Definition: ScopeService.java:227
CacheService cacheService
Definition: ScopeService.java:38
Logger log
Definition: ScopeService.java:35

メンバ詳解

◆ CACHE_SCOPE_NAME

final String org.xdi.oxauth.service.ScopeService.CACHE_SCOPE_NAME = "ScopeCache"
staticprivate

◆ cacheService

CacheService org.xdi.oxauth.service.ScopeService.cacheService
private

◆ ldapEntryManager

PersistenceEntryManager org.xdi.oxauth.service.ScopeService.ldapEntryManager
private

◆ log

Logger org.xdi.oxauth.service.ScopeService.log
private

◆ staticConfiguration

StaticConfiguration org.xdi.oxauth.service.ScopeService.staticConfiguration
private

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