registration.addListener(listener); if (registration.activeRegistration()) { return registration.authConfigProvider; Registration listenerRegistration = new Registration(layer, appContext); listenerRegistration.addListener(listener); layerContextRegistration.put(fullKey, listenerRegistration); if (registration != null && registration.activeRegistration()) { return registration.authConfigProvider; if (registration != null && registration.activeRegistration()) { return registration.authConfigProvider; if (registration != null && registration.activeRegistration()) { return registration.authConfigProvider;
while (registrationIterator.hasNext()) { Entry<LayerContextKey, Registration> entry = registrationIterator.next(); if (entry.getValue().getRegistrationId().equals(registrationId)) { existingListeners = entry.getValue().clearListeners(); layer = entry.getKey().messageLayer; appContext = entry.getKey().appContext;
/** * @see javax.security.auth.message.config.AuthConfigFactory#detachListener(javax.security.auth.message.config.RegistrationListener, java.lang.String, java.lang.String) */ @Override public String[] detachListener(RegistrationListener listener, String layer, String appContext) { checkNotNullParam("listener", listener); checkPermission(providerRegistrationSecurityPermission); List<String> registrationIDs = new ArrayList<>(); synchronized (layerContextRegistration) { for (Registration current : layerContextRegistration.values()) { if ((layer == null || layer.equals(current.messageLayer)) && (appContext == null || appContext.equals(current.appContext))) { if (current.removeListener(listener)) { registrationIDs.add(current.getRegistrationId()); } } } } return registrationIDs.toArray(new String[registrationIDs.size()]); }
registration.addListener(listener); if (registration.activeRegistration()) { return registration.authConfigProvider; Registration listenerRegistration = new Registration(layer, appContext); listenerRegistration.addListener(listener); layerContextRegistration.put(fullKey, listenerRegistration); if (registration != null && registration.activeRegistration()) { return registration.authConfigProvider; if (registration != null && registration.activeRegistration()) { return registration.authConfigProvider; if (registration != null && registration.activeRegistration()) { return registration.authConfigProvider;
registration.addListener(listener); if (registration.activeRegistration()) { return registration.authConfigProvider; Registration listenerRegistration = new Registration(layer, appContext); listenerRegistration.addListener(listener); layerContextRegistration.put(fullKey, listenerRegistration); if (registration != null && registration.activeRegistration()) { return registration.authConfigProvider; if (registration != null && registration.activeRegistration()) { return registration.authConfigProvider; if (registration != null && registration.activeRegistration()) { return registration.authConfigProvider;
while (registrationIterator.hasNext()) { Entry<LayerContextKey, Registration> entry = registrationIterator.next(); if (entry.getValue().getRegistrationId().equals(registrationId)) { existingListeners = entry.getValue().clearListeners(); layer = entry.getKey().messageLayer; appContext = entry.getKey().appContext;
while (registrationIterator.hasNext()) { Entry<LayerContextKey, Registration> entry = registrationIterator.next(); if (entry.getValue().getRegistrationId().equals(registrationId)) { existingListeners = entry.getValue().clearListeners(); layer = entry.getKey().messageLayer; appContext = entry.getKey().appContext;
boolean matchesRegistration(final String layer, final String appContext) { synchronized (layerContextRegistration) { // Step 1 - Exact Match Registration registration = layerContextRegistration.get(new LayerContextKey(layer, appContext)); if (registration != null && registration.activeRegistration()) { return true; } // Step 2 - appContext only registration = layerContextRegistration.get(new LayerContextKey(null, appContext)); if (registration != null && registration.activeRegistration()) { return true; } // Step 3 - layer only registration = layerContextRegistration.get(new LayerContextKey(layer, null)); if (registration != null && registration.activeRegistration()) { return true; } // Step 4 - No appContext or layer registration = layerContextRegistration.get(new LayerContextKey(null, null)); if (registration != null && registration.activeRegistration()) { return true; } } return false; }
/** * @see javax.security.auth.message.config.AuthConfigFactory#getRegistrationIDs(javax.security.auth.message.config.AuthConfigProvider) */ @Override public String[] getRegistrationIDs(AuthConfigProvider provider) { List<String> registrationIDs = new ArrayList<>(); synchronized (layerContextRegistration) { if (provider != null) { for (Registration current : layerContextRegistration.values()) { if (provider.equals(current.authConfigProvider)) { registrationIDs.add(current.registrationId); } } } else { for (Registration current : layerContextRegistration.values()) { if (current.activeRegistration()) { // The registration may exist just to hold listeners. registrationIDs.add(current.registrationId); } } } } return registrationIDs.toArray(new String[registrationIDs.size()]); }
/** * @see javax.security.auth.message.config.AuthConfigFactory#getRegistrationIDs(javax.security.auth.message.config.AuthConfigProvider) */ @Override public String[] getRegistrationIDs(AuthConfigProvider provider) { List<String> registrationIDs = new ArrayList<>(); synchronized (layerContextRegistration) { if (provider != null) { for (Registration current : layerContextRegistration.values()) { if (provider.equals(current.authConfigProvider)) { registrationIDs.add(current.registrationId); } } } else { for (Registration current : layerContextRegistration.values()) { if (current.activeRegistration()) { // The registration may exist just to hold listeners. registrationIDs.add(current.registrationId); } } } } return registrationIDs.toArray(new String[registrationIDs.size()]); }
boolean matchesRegistration(final String layer, final String appContext) { synchronized (layerContextRegistration) { // Step 1 - Exact Match Registration registration = layerContextRegistration.get(new LayerContextKey(layer, appContext)); if (registration != null && registration.activeRegistration()) { return true; } // Step 2 - appContext only registration = layerContextRegistration.get(new LayerContextKey(null, appContext)); if (registration != null && registration.activeRegistration()) { return true; } // Step 3 - layer only registration = layerContextRegistration.get(new LayerContextKey(layer, null)); if (registration != null && registration.activeRegistration()) { return true; } // Step 4 - No appContext or layer registration = layerContextRegistration.get(new LayerContextKey(null, null)); if (registration != null && registration.activeRegistration()) { return true; } } return false; }
String registerConfigProvider(AuthConfigProvider provider, String layer, String appContext, String description, boolean persistent) { Registration registration = null; List<RegistrationListener> existingListeners; synchronized(layerContextRegistration) { LayerContextKey key = new LayerContextKey(layer, appContext); registration = layerContextRegistration.get(key); if (registration == null) { registration = new Registration(layer, appContext); layerContextRegistration.put(key, registration); existingListeners = Collections.emptyList(); } else { existingListeners = registration.clearListeners(); } registration.setDescription(description); registration.setPersistent(persistent); registration.setAuthConfigProvider(provider, provider == null); } // Handle notify outside the synchronized block in case they want to re-register. for (RegistrationListener current : existingListeners) { current.notify(layer, appContext); } return registration.getRegistrationId(); }
String registerConfigProvider(AuthConfigProvider provider, String layer, String appContext, String description, boolean persistent) { Registration registration = null; List<RegistrationListener> existingListeners; synchronized(layerContextRegistration) { LayerContextKey key = new LayerContextKey(layer, appContext); registration = layerContextRegistration.get(key); if (registration == null) { registration = new Registration(layer, appContext); layerContextRegistration.put(key, registration); existingListeners = Collections.emptyList(); } else { existingListeners = registration.clearListeners(); } registration.setDescription(description); registration.setPersistent(persistent); registration.setAuthConfigProvider(provider, provider == null); } // Handle notify outside the synchronized block in case they want to re-register. for (RegistrationListener current : existingListeners) { current.notify(layer, appContext); } return registration.getRegistrationId(); }
/** * @see javax.security.auth.message.config.AuthConfigFactory#detachListener(javax.security.auth.message.config.RegistrationListener, java.lang.String, java.lang.String) */ @Override public String[] detachListener(RegistrationListener listener, String layer, String appContext) { checkNotNullParam("listener", listener); checkPermission(providerRegistrationSecurityPermission); List<String> registrationIDs = new ArrayList<>(); synchronized (layerContextRegistration) { for (Registration current : layerContextRegistration.values()) { if ((layer == null || layer.equals(current.messageLayer)) && (appContext == null || appContext.equals(current.appContext))) { if (current.removeListener(listener)) { registrationIDs.add(current.getRegistrationId()); } } } } return registrationIDs.toArray(new String[registrationIDs.size()]); }
/** * @see javax.security.auth.message.config.AuthConfigFactory#detachListener(javax.security.auth.message.config.RegistrationListener, java.lang.String, java.lang.String) */ @Override public String[] detachListener(RegistrationListener listener, String layer, String appContext) { checkNotNullParam("listener", listener); checkPermission(providerRegistrationSecurityPermission); List<String> registrationIDs = new ArrayList<>(); synchronized (layerContextRegistration) { for (Registration current : layerContextRegistration.values()) { if ((layer == null || layer.equals(current.messageLayer)) && (appContext == null || appContext.equals(current.appContext))) { if (current.removeListener(listener)) { registrationIDs.add(current.getRegistrationId()); } } } } return registrationIDs.toArray(new String[registrationIDs.size()]); }
/** * @see javax.security.auth.message.config.AuthConfigFactory#getRegistrationContext(java.lang.String) */ @Override public RegistrationContext getRegistrationContext(String registrationID) { synchronized (layerContextRegistration) { for (Registration current : layerContextRegistration.values()) { if (current.getRegistrationId().equals(registrationID)) { return current.toRegistrationContext(); } } } return null; }
/** * @see javax.security.auth.message.config.AuthConfigFactory#getRegistrationContext(java.lang.String) */ @Override public RegistrationContext getRegistrationContext(String registrationID) { synchronized (layerContextRegistration) { for (Registration current : layerContextRegistration.values()) { if (current.getRegistrationId().equals(registrationID)) { return current.toRegistrationContext(); } } } return null; }
RegistrationContext toRegistrationContext() { // We return a new instance to avoid state changes being detected by stale references. return activeRegistration() ? new ElytronRegistrationContext(messageLayer, appContext, description, persistent) : null; }
RegistrationContext toRegistrationContext() { // We return a new instance to avoid state changes being detected by stale references. return activeRegistration() ? new ElytronRegistrationContext(messageLayer, appContext, description, persistent) : null; }
boolean matchesRegistration(final String layer, final String appContext) { synchronized (layerContextRegistration) { // Step 1 - Exact Match Registration registration = layerContextRegistration.get(new LayerContextKey(layer, appContext)); if (registration != null && registration.activeRegistration()) { return true; } // Step 2 - appContext only registration = layerContextRegistration.get(new LayerContextKey(null, appContext)); if (registration != null && registration.activeRegistration()) { return true; } // Step 3 - layer only registration = layerContextRegistration.get(new LayerContextKey(layer, null)); if (registration != null && registration.activeRegistration()) { return true; } // Step 4 - No appContext or layer registration = layerContextRegistration.get(new LayerContextKey(null, null)); if (registration != null && registration.activeRegistration()) { return true; } } return false; }