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

公開メンバ関数

List< UmaScopeDescriptiongetAllScopes ()
 
UmaScopeDescription getScope (String scopeId)
 
boolean persist (UmaScopeDescription scope)
 
List< String > getScopeDNsByIdsAndAddToLdapIfNeeded (List< String > scopeIds)
 
List< UmaScopeDescriptiongetScopesByDns (List< String > scopeDns)
 
List< String > getScopeIdsByDns (List< String > scopeDns)
 
List< String > getScopeIds (List< UmaScopeDescription > scopes)
 
List< UmaScopeDescriptiongetScopesByIds (List< String > scopeIds)
 
UmaScopeDescription addScope (String scopeId)
 
String getScopeEndpoint ()
 
String baseDn ()
 

静的公開メンバ関数

static String asString (Collection< UmaScopeDescription > scopes)
 

非公開メンバ関数

Filter createAnyFilterByIds (List< String > scopeIds)
 

非公開変数類

Logger log
 
PersistenceEntryManager ldapEntryManager
 
InumService inumService
 
ErrorResponseFactory errorResponseFactory
 
AppConfiguration appConfiguration
 
StaticConfiguration staticConfiguration
 

詳解

著者
Yuriy Zabrovarnyy
Yuriy Movchan
バージョン
0.9, 22/04/2013

関数詳解

◆ addScope()

UmaScopeDescription org.xdi.oxauth.uma.service.UmaScopeService.addScope ( String  scopeId)
inline
165  {
166  final Boolean addAutomatically = appConfiguration.getUmaAddScopesAutomatically();
167  if (addAutomatically != null && addAutomatically) {
168  final String inum = inumService.generateInum();
169  final UmaScopeDescription newScope = new UmaScopeDescription();
170  newScope.setInum(inum);
171  newScope.setDisplayName(scopeId);
172  newScope.setId(scopeId);
173 
174  final boolean persisted = persist(newScope);
175  if (persisted) {
176  return newScope;
177  } else {
178  log.error("Failed to persist scope, id:{}" + scopeId);
179  }
180  }
181 
182  throw new UmaWebException(Response.Status.BAD_REQUEST, errorResponseFactory, UmaErrorResponseType.INVALID_RESOURCE_SCOPE);
183 
184  }
boolean persist(UmaScopeDescription scope)
Definition: UmaScopeService.java:88
Logger log
Definition: UmaScopeService.java:42
ErrorResponseFactory errorResponseFactory
Definition: UmaScopeService.java:51
Boolean getUmaAddScopesAutomatically()
Definition: AppConfiguration.java:237
AppConfiguration appConfiguration
Definition: UmaScopeService.java:54
InumService inumService
Definition: UmaScopeService.java:48
String generateInum()
Definition: InumService.java:49

◆ asString()

static String org.xdi.oxauth.uma.service.UmaScopeService.asString ( Collection< UmaScopeDescription scopes)
inlinestatic
209  {
210  String result = "";
211  for (UmaScopeDescription scope : scopes) {
212  result += scope.getId() + " ";
213  }
214  return result.trim();
215  }

◆ baseDn()

String org.xdi.oxauth.uma.service.UmaScopeService.baseDn ( )
inline
205  {
206  return String.format("ou=scopes,%s", staticConfiguration.getBaseDn().getUmaBase());
207  }
String getUmaBase()
Definition: BaseDnConfiguration.java:53
StaticConfiguration staticConfiguration
Definition: UmaScopeService.java:57
BaseDnConfiguration getBaseDn()
Definition: StaticConfiguration.java:32

◆ createAnyFilterByIds()

Filter org.xdi.oxauth.uma.service.UmaScopeService.createAnyFilterByIds ( List< String >  scopeIds)
inlineprivate
190  {
191  if (scopeIds != null && !scopeIds.isEmpty()) {
192  List<Filter> filters = new ArrayList<Filter>();
193  for (String url : scopeIds) {
194  Filter filter = Filter.createEqualityFilter("oxId", url);
195  filters.add(filter);
196  }
197  Filter filter = Filter.createORFilter(filters.toArray(new Filter[0]));
198  log.trace("Uma scope ids: " + scopeIds + ", ldapFilter: " + filter);
199  return filter;
200  }
201 
202  return null;
203  }
Logger log
Definition: UmaScopeService.java:42

◆ getAllScopes()

List<UmaScopeDescription> org.xdi.oxauth.uma.service.UmaScopeService.getAllScopes ( )
inline
59  {
60  try {
61  return ldapEntryManager.findEntries(baseDn(), UmaScopeDescription.class, Filter.createPresenceFilter("inum"));
62  } catch (Exception e) {
63  log.error(e.getMessage(), e);
64  }
65  return Collections.emptyList();
66  }
String baseDn()
Definition: UmaScopeService.java:205
Logger log
Definition: UmaScopeService.java:42
PersistenceEntryManager ldapEntryManager
Definition: UmaScopeService.java:45

◆ getScope()

UmaScopeDescription org.xdi.oxauth.uma.service.UmaScopeService.getScope ( String  scopeId)
inline
68  {
69  try {
70  final Filter filter = Filter.create(String.format("&(oxId=%s)", scopeId));
71  final List<UmaScopeDescription> entries = ldapEntryManager.findEntries(baseDn(), UmaScopeDescription.class, filter);
72  if (entries != null && !entries.isEmpty()) {
73  // if more then one scope then it's problem, non-deterministic behavior, id must be unique
74  if (entries.size() > 1) {
75  log.error("Found more then one UMA scope, id: {}", scopeId);
76  for (UmaScopeDescription s : entries) {
77  log.error("Scope, Id: {}, dn: {}", s.getId(), s.getDn());
78  }
79  }
80  return entries.get(0);
81  }
82  } catch (Exception e) {
83  log.error(e.getMessage(), e);
84  }
85  return null;
86  }
String baseDn()
Definition: UmaScopeService.java:205
Logger log
Definition: UmaScopeService.java:42
PersistenceEntryManager ldapEntryManager
Definition: UmaScopeService.java:45

◆ getScopeDNsByIdsAndAddToLdapIfNeeded()

List<String> org.xdi.oxauth.uma.service.UmaScopeService.getScopeDNsByIdsAndAddToLdapIfNeeded ( List< String >  scopeIds)
inline
102  {
103  List<String> result = new ArrayList<String>();
104  for (UmaScopeDescription scope : getScopesByIds(scopeIds)) {
105  result.add(scope.getDn());
106  }
107  return result;
108  }
List< UmaScopeDescription > getScopesByIds(List< String > scopeIds)
Definition: UmaScopeService.java:143

◆ getScopeEndpoint()

String org.xdi.oxauth.uma.service.UmaScopeService.getScopeEndpoint ( )
inline
186  {
187  return appConfiguration.getBaseEndpoint() + UmaMetadataWS.UMA_SCOPES_SUFFIX;
188  }
AppConfiguration appConfiguration
Definition: UmaScopeService.java:54
String getBaseEndpoint()
Definition: AppConfiguration.java:328

◆ getScopeIds()

List<String> org.xdi.oxauth.uma.service.UmaScopeService.getScopeIds ( List< UmaScopeDescription scopes)
inline
133  {
134  final List<String> result = new ArrayList<String>();
135  if (scopes != null && !scopes.isEmpty()) {
136  for (UmaScopeDescription scope : scopes) {
137  result.add(scope.getId());
138  }
139  }
140  return result;
141  }

◆ getScopeIdsByDns()

List<String> org.xdi.oxauth.uma.service.UmaScopeService.getScopeIdsByDns ( List< String >  scopeDns)
inline
129  {
130  return getScopeIds(getScopesByDns(scopeDns));
131  }
List< UmaScopeDescription > getScopesByDns(List< String > scopeDns)
Definition: UmaScopeService.java:110
List< String > getScopeIds(List< UmaScopeDescription > scopes)
Definition: UmaScopeService.java:133

◆ getScopesByDns()

List<UmaScopeDescription> org.xdi.oxauth.uma.service.UmaScopeService.getScopesByDns ( List< String >  scopeDns)
inline
110  {
111  final List<UmaScopeDescription> result = new ArrayList<UmaScopeDescription>();
112  try {
113  if (scopeDns != null && !scopeDns.isEmpty()) {
114  for (String dn : scopeDns) {
115  final UmaScopeDescription scopeDescription = ldapEntryManager.find(UmaScopeDescription.class, dn);
116  if (scopeDescription != null) {
117  result.add(scopeDescription);
118  } else {
119  log.error("Failed to load UMA scope with dn: {}", dn);
120  }
121  }
122  }
123  } catch (Exception e) {
124  log.error(e.getMessage(), e);
125  }
126  return result;
127  }
Logger log
Definition: UmaScopeService.java:42
PersistenceEntryManager ldapEntryManager
Definition: UmaScopeService.java:45

◆ getScopesByIds()

List<UmaScopeDescription> org.xdi.oxauth.uma.service.UmaScopeService.getScopesByIds ( List< String >  scopeIds)
inline
143  {
144  List<UmaScopeDescription> result = new ArrayList<UmaScopeDescription>();
145  if (scopeIds != null && !scopeIds.isEmpty()) {
146  List<String> notInLdap = new ArrayList<String>(scopeIds);
147 
148  final List<UmaScopeDescription> entries = ldapEntryManager.findEntries(baseDn(), UmaScopeDescription.class, createAnyFilterByIds(scopeIds));
149  if (entries != null) {
150  result.addAll(entries);
151  for (UmaScopeDescription scope : entries) {
152  notInLdap.remove(scope.getId());
153  }
154  }
155 
156  if (!notInLdap.isEmpty()) {
157  for (String scopeId : notInLdap) {
158  result.add(addScope(scopeId));
159  }
160  }
161  }
162  return result;
163  }
String baseDn()
Definition: UmaScopeService.java:205
Filter createAnyFilterByIds(List< String > scopeIds)
Definition: UmaScopeService.java:190
PersistenceEntryManager ldapEntryManager
Definition: UmaScopeService.java:45
UmaScopeDescription addScope(String scopeId)
Definition: UmaScopeService.java:165

◆ persist()

boolean org.xdi.oxauth.uma.service.UmaScopeService.persist ( UmaScopeDescription  scope)
inline
88  {
89  try {
90  if (StringUtils.isBlank(scope.getDn())) {
91  scope.setDn(String.format("inum=%s,%s", scope.getInum(), baseDn()));
92  }
93 
94  ldapEntryManager.persist(scope);
95  return true;
96  } catch (Exception e) {
97  log.error(e.getMessage(), e);
98  return false;
99  }
100  }
String baseDn()
Definition: UmaScopeService.java:205
Logger log
Definition: UmaScopeService.java:42
PersistenceEntryManager ldapEntryManager
Definition: UmaScopeService.java:45

メンバ詳解

◆ appConfiguration

AppConfiguration org.xdi.oxauth.uma.service.UmaScopeService.appConfiguration
private

◆ errorResponseFactory

ErrorResponseFactory org.xdi.oxauth.uma.service.UmaScopeService.errorResponseFactory
private

◆ inumService

InumService org.xdi.oxauth.uma.service.UmaScopeService.inumService
private

◆ ldapEntryManager

PersistenceEntryManager org.xdi.oxauth.uma.service.UmaScopeService.ldapEntryManager
private

◆ log

Logger org.xdi.oxauth.uma.service.UmaScopeService.log
private

◆ staticConfiguration

StaticConfiguration org.xdi.oxauth.uma.service.UmaScopeService.staticConfiguration
private

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