/** * Set the realm identity map to contain a single entry. * * @param name the entry name * @param password the password * @param attributes the identity attributes * @deprecated Use {@link #setIdentityMap(Map)} instead. */ @Deprecated public void setPasswordMap(final String name, final Password password, final Attributes attributes) { setIdentityMap(Collections.singletonMap(name, new SimpleRealmEntry( Collections.singletonList(new PasswordCredential(password)), attributes ))); }
/** * Set the realm identity map to contain a single entry. * * @param name the entry name * @param password the password * @param attributes the identity attributes * @deprecated Use {@link #setIdentityMap(Map)} instead. */ @Deprecated public void setPasswordMap(final String name, final Password password, final Attributes attributes) { setIdentityMap(Collections.singletonMap(name, new SimpleRealmEntry( Collections.singletonList(new PasswordCredential(password)), attributes ))); }
/** * Set the realm identity map to contain a single entry. * * @param name the entry name * @param password the password * @param attributes the identity attributes * @deprecated Use {@link #setIdentityMap(Map)} instead. */ @Deprecated public void setPasswordMap(final String name, final Password password, final Attributes attributes) { setIdentityMap(Collections.singletonMap(name, new SimpleRealmEntry( Collections.singletonList(new PasswordCredential(password)), attributes ))); }
/** * Set the realm identity map to contain a single entry. * * @param name the entry name * @param password the password * @param attributes the identity attributes * @deprecated Use {@link #setIdentityMap(Map)} instead. */ @Deprecated public void setPasswordMap(final String name, final Password password, final Attributes attributes) { setIdentityMap(Collections.singletonMap(name, new SimpleRealmEntry( Collections.singletonList(new PasswordCredential(password)), attributes ))); }
@Override protected ValueSupplier<SecurityRealm> getValueSupplier(ServiceBuilder<SecurityRealm> serviceBuilder, OperationContext context, ModelNode model) throws OperationFailedException { final String identity = IDENTITY.resolveModelAttribute(context, model).asString(); final String attributeName = ATTRIBUTE_NAME.resolveModelAttribute(context, model).asStringOrNull(); final List<String> attributeValues = ATTRIBUTE_VALUES.unwrap(context, model); return () -> { final Map<String, ? extends Collection<String>> attributesMap; if (attributeName != null) { attributesMap = Collections.singletonMap(attributeName, Collections.unmodifiableList(attributeValues)); } else { attributesMap = Collections.emptyMap(); } final Map<String, SimpleRealmEntry> realmMap = Collections.singletonMap(identity, new SimpleRealmEntry(Collections.emptyList(), new MapAttributes(attributesMap))); SimpleMapBackedSecurityRealm securityRealm = new SimpleMapBackedSecurityRealm(); securityRealm.setPasswordMap(realmMap); return securityRealm; }; } };