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

公開メンバ関数

void initTimer ()
 
void processMetadataValidationTimerEvent ( @Observes @Scheduled EntityIdMonitoringEvent entityIdMonitoringEvent)
 
void process ()
 

非公開変数類

Logger log
 
Event< TimerEvent > timerEvent
 
AppConfiguration appConfiguration
 
ServiceUtil serviceUtil
 
TrustService trustService
 
AtomicBoolean isActive
 

静的非公開変数類

static final String ENTITY_ID_VANISHED_MESSAGE = "Invalidated because parent federation does not contain this entityId any more."
 
static final int DEFAULT_INTERVAL = 2 * 60
 

詳解

著者
otataryn

関数詳解

◆ initTimer()

void org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.initTimer ( )
inline
67  {
68  log.debug("Initializing EntityId Monitoring Timer");
69  this.isActive = new AtomicBoolean(false);
70 
71  final int delay = 30;
72  final int interval = DEFAULT_INTERVAL;
73 
74  timerEvent.fire(new TimerEvent(new TimerSchedule(delay, interval), new EntityIdMonitoringEvent(),
75  Scheduled.Literal.INSTANCE));
76  }
AtomicBoolean isActive
Definition: EntityIDMonitoringService.java:65
Logger log
Definition: EntityIDMonitoringService.java:51
Event< TimerEvent > timerEvent
Definition: EntityIDMonitoringService.java:54
static final int DEFAULT_INTERVAL
Definition: EntityIDMonitoringService.java:48

◆ process()

void org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.process ( )
inline
98  {
99  log.trace("Starting entityId monitoring process.");
100  log.trace("EVENT_METADATA_ENTITY_ID_UPDATE Starting");
101  for (GluuSAMLTrustRelationship tr : trustService.getAllTrustRelationships()) {
102  log.trace("Evaluating TR " + tr.getDn());
103  boolean meatadataAvailable = tr.getSpMetaDataFN() != null && StringHelper.isNotEmpty(tr.getSpMetaDataFN());
104  log.trace("meatadataAvailable:" + meatadataAvailable);
105  boolean correctType = trustService.getTrustContainerFederation(tr) == null;
106  log.trace("correctType:" + correctType);
107  boolean isValidated = GluuValidationStatus.VALIDATION_SUCCESS.equals(tr.getValidationStatus());
108  log.trace("isValidated:" + isValidated);
109  if (meatadataAvailable && correctType && isValidated) {
110  String idpMetadataFolder = appConfiguration.getShibboleth3IdpRootDir() + File.separator
111  + Shibboleth3ConfService.SHIB3_IDP_METADATA_FOLDER + File.separator;
112  File metadataFile = new File(idpMetadataFolder + tr.getSpMetaDataFN());
113  List<String> entityIds = SAMLMetadataParser.getEntityIdFromMetadataFile(metadataFile);
114 
115  log.trace("entityIds from metadata: " + serviceUtil.iterableToString(entityIds));
116  Set<String> entityIdSet = new TreeSet<String>();
117 
118  if (entityIds != null && !entityIds.isEmpty()) {
119  Set<String> duplicatesSet = new TreeSet<String>();
120  for (String entityId : entityIds) {
121  if (!entityIdSet.add(entityId)) {
122  duplicatesSet.add(entityId);
123  }
124  }
125  }
126 
127  log.trace("unique entityIds: " + serviceUtil.iterableToString(entityIdSet));
128  Collection<String> disjunction = CollectionUtils.disjunction(entityIdSet, tr.getGluuEntityId());
129  log.trace("entityIds disjunction: " + serviceUtil.iterableToString(disjunction));
130 
131  if (!disjunction.isEmpty()) {
132  log.trace("entityIds disjunction is not empty. Somthing has changed. Processing further.");
133  tr.setGluuEntityId(entityIdSet);
134  if (tr.isFederation()) {
135  List<GluuSAMLTrustRelationship> parts = trustService.getDeconstructedTrustRelationships(tr);
136  for (GluuSAMLTrustRelationship part : parts) {
137  log.trace("Processing TR part: " + part.getDn());
138  boolean isActive = part.getStatus() != null && GluuStatus.ACTIVE.equals(part.getStatus());
139  log.trace("isActive:" + isActive);
140  boolean entityIdPresent = entityIdSet != null && entityIdSet.contains(part.getEntityId());
141  log.trace("entityIdPresent:" + entityIdPresent);
142  boolean previouslyDisabled = part.getValidationLog() != null && part.getValidationLog()
143  .contains(ENTITY_ID_VANISHED_MESSAGE + " : " + part.getEntityId());
144  log.trace("previouslyDisabled:" + previouslyDisabled);
145  if (isActive && !entityIdPresent) {
146  log.trace("no entityId found for part : " + part.getDn());
147  part.setStatus(GluuStatus.INACTIVE);
148  List<String> log = new ArrayList<String>();
149  log.add(ENTITY_ID_VANISHED_MESSAGE + " : " + part.getEntityId());
150  part.setValidationLog(log);
152  }
153  if (entityIdPresent && previouslyDisabled) {
154  log.trace("entityId found for part : " + part.getDn());
155  part.setStatus(GluuStatus.ACTIVE);
156  List<String> log = part.getValidationLog();
157  List<String> updatedLog = new ArrayList<String>(log);
158  updatedLog.remove(ENTITY_ID_VANISHED_MESSAGE + " : " + part.getEntityId());
159  if (updatedLog.isEmpty()) {
160  updatedLog = null;
161  }
162  part.setValidationLog(updatedLog);
164  }
165  }
166  }
167 
169  }
170  }
171  }
172  }
AtomicBoolean isActive
Definition: EntityIDMonitoringService.java:65
ServiceUtil serviceUtil
Definition: EntityIDMonitoringService.java:60
String iterableToString(Iterable<?> list)
Definition: ServiceUtil.java:107
List< GluuSAMLTrustRelationship > getAllTrustRelationships()
Definition: TrustService.java:198
static final String ENTITY_ID_VANISHED_MESSAGE
Definition: EntityIDMonitoringService.java:46
Logger log
Definition: EntityIDMonitoringService.java:51
GluuSAMLTrustRelationship getTrustContainerFederation(GluuSAMLTrustRelationship trustRelationship)
Definition: TrustService.java:425
void updateTrustRelationship(GluuSAMLTrustRelationship trustRelationship)
Definition: TrustService.java:111
AppConfiguration appConfiguration
Definition: EntityIDMonitoringService.java:57
TrustService trustService
Definition: EntityIDMonitoringService.java:63
List< GluuSAMLTrustRelationship > getDeconstructedTrustRelationships(GluuSAMLTrustRelationship trustRelationship)
Definition: TrustService.java:406

◆ processMetadataValidationTimerEvent()

void org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.processMetadataValidationTimerEvent ( @Observes @Scheduled EntityIdMonitoringEvent  entityIdMonitoringEvent)
inline
80  {
81  if (this.isActive.get()) {
82  return;
83  }
84 
85  if (!this.isActive.compareAndSet(false, true)) {
86  return;
87  }
88 
89  try {
90  process();
91  } catch (Throwable ex) {
92  log.error("Exception happened while monitoring EntityId", ex);
93  } finally {
94  this.isActive.set(false);
95  }
96  }
AtomicBoolean isActive
Definition: EntityIDMonitoringService.java:65
void process()
Definition: EntityIDMonitoringService.java:98
Logger log
Definition: EntityIDMonitoringService.java:51

メンバ詳解

◆ appConfiguration

AppConfiguration org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.appConfiguration
private

◆ DEFAULT_INTERVAL

final int org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.DEFAULT_INTERVAL = 2 * 60
staticprivate

◆ ENTITY_ID_VANISHED_MESSAGE

final String org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.ENTITY_ID_VANISHED_MESSAGE = "Invalidated because parent federation does not contain this entityId any more."
staticprivate

◆ isActive

AtomicBoolean org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.isActive
private

◆ log

Logger org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.log
private

◆ serviceUtil

ServiceUtil org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.serviceUtil
private

◆ timerEvent

Event<TimerEvent> org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.timerEvent
private

◆ trustService

TrustService org.gluu.oxtrust.ldap.service.EntityIDMonitoringService.trustService
private

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