@Override
  public ManagementResourceRegistration registerOverrideModel(
      String name, OverrideDescriptionProvider descriptionProvider) {
    Assert.checkNotNullParam("name", name);
    Assert.checkNotNullParam("descriptionProvider", descriptionProvider);

    if (parent == null) {
      throw ControllerLogger.ROOT_LOGGER.cannotOverrideRootRegistration();
    }

    if (!PathElement.WILDCARD_VALUE.equals(valueString)) {
      throw ControllerLogger.ROOT_LOGGER.cannotOverrideNonWildCardRegistration(valueString);
    }
    PathElement pe = PathElement.pathElement(parent.getKeyName(), name);

    final SimpleResourceDefinition rd =
        new SimpleResourceDefinition(
            pe,
            new OverrideDescriptionCombiner(
                getModelDescription(PathAddress.EMPTY_ADDRESS), descriptionProvider)) {

          @Override
          public List<AccessConstraintDefinition> getAccessConstraints() {
            return AbstractResourceRegistration.this.getAccessConstraints();
          }
        };
    return parent.getParent().registerSubModel(rd);
  }
Ejemplo n.º 2
0
 /**
  * Construct a new instance.
  *
  * @param spi the password factory SPI (not {@code null})
  * @param provider the provider (not {@code null})
  * @param algorithm the algorithm name (not {@code null})
  */
 public PasswordFactory(
     final PasswordFactorySpi spi, final Provider provider, final String algorithm) {
   Assert.checkNotNullParam("spi", spi);
   Assert.checkNotNullParam("provider", provider);
   Assert.checkNotNullParam("algorithm", algorithm);
   this.provider = provider;
   this.algorithm = algorithm;
   this.spi = spi;
 }
Ejemplo n.º 3
0
 /**
  * Safely pass an event to a security realm, absorbing and logging any exception that occurs.
  *
  * @param realm the security realm to notify (not {@code null})
  * @param event the event to send (not {@code null})
  */
 static void safeHandleRealmEvent(SecurityRealm realm, RealmEvent event) {
   Assert.checkNotNullParam("realm", realm);
   Assert.checkNotNullParam("event", event);
   try {
     realm.handleRealmEvent(event);
   } catch (Throwable t) {
     ElytronMessages.log.eventHandlerFailed(t);
   }
 }
 @Override
 public void unregisterOverrideModel(String name) {
   Assert.checkNotNullParam("name", name);
   if (PathElement.WILDCARD_VALUE.equals(name)) {
     throw ControllerLogger.ROOT_LOGGER.wildcardRegistrationIsNotAnOverride();
   }
   if (parent == null) {
     throw ControllerLogger.ROOT_LOGGER.rootRegistrationIsNotOverridable();
   }
   PathElement pe = PathElement.pathElement(parent.getKeyName(), name);
   parent.getParent().unregisterSubModel(pe);
 }
  SunUnixMD5CryptPasswordImpl(
      final String algorithm,
      final byte[] clonedHash,
      final byte[] clonedSalt,
      final int iterationCount) {
    Assert.checkNotNullParam("algorithm", algorithm);
    if (!algorithm.equals(ALGORITHM_SUN_CRYPT_MD5)
        && !algorithm.equals(ALGORITHM_SUN_CRYPT_MD5_BARE_SALT)) {
      throw log.unrecognizedAlgorithm(algorithm);
    }

    this.algorithm = algorithm;
    this.hash = clonedHash;
    this.salt = clonedSalt;
    this.iterationCount = iterationCount;
  }
  /** {@inheritDoc} */
  @Override
  public final ManagementResourceRegistration getOverrideModel(String name) {

    Assert.checkNotNullParam("name", name);

    if (parent == null) {
      throw ControllerLogger.ROOT_LOGGER.cannotOverrideRootRegistration();
    }

    if (!PathElement.WILDCARD_VALUE.equals(valueString)) {
      throw ControllerLogger.ROOT_LOGGER.cannotOverrideNonWildCardRegistration(valueString);
    }
    PathElement pe = PathElement.pathElement(parent.getKeyName(), name);

    // TODO https://issues.jboss.org/browse/WFLY-2883
    //        ManagementResourceRegistration candidate =
    // parent.getParent().getSubModel(PathAddress.pathAddress(pe));
    //        // We may have gotten back the wildcard reg; detect this by checking for allowing
    // override
    //        return candidate.isAllowsOverride() ? null : candidate;
    return parent.getParent().getSubModel(PathAddress.pathAddress(pe));
  }
Ejemplo n.º 7
0
 @Override
 public <V> V detach(final AttachmentKey<V> key) {
   Assert.checkNotNullParam("key", key);
   return key.cast(valueAttachments.remove(key));
 }
Ejemplo n.º 8
0
 @Override
 public <V> V attachIfAbsent(final AttachmentKey<V> key, final V value) {
   Assert.checkNotNullParam("key", key);
   return key.cast(valueAttachments.putIfAbsent(key, value));
 }
Ejemplo n.º 9
0
 public SupportLevel getEvidenceVerifySupport(
     final Class<? extends Evidence> evidenceType, final String algorithmName)
     throws RealmUnavailableException {
   Assert.checkNotNullParam("evidenceType", evidenceType);
   return SupportLevel.UNSUPPORTED;
 }
Ejemplo n.º 10
0
 public SupportLevel getCredentialAcquireSupport(
     final Class<? extends Credential> credentialType, final String algorithmName)
     throws RealmUnavailableException {
   Assert.checkNotNullParam("credentialType", credentialType);
   return SupportLevel.UNSUPPORTED;
 }
Ejemplo n.º 11
0
 /** {@inheritDoc} */
 public synchronized <T> T putAttachment(final AttachmentKey<T> key, final T value) {
   Assert.checkNotNullParam("key", key);
   return key.cast(attachments.put(key, key.cast(value)));
 }
 public IteratedHashPasswordSpec(byte[] hash, int iterationCount) {
   Assert.checkNotNullParam("hash", hash);
   this.hash = hash;
   this.iterationCount = iterationCount;
 }