Skip to content

Commit

Permalink
[WFCORE-2512] Make the module attribute required on all custom compon…
Browse files Browse the repository at this point in the history
…ent definitions.
  • Loading branch information
darranl committed Mar 9, 2017
1 parent 0702423 commit 770074c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
Expand Up @@ -19,7 +19,6 @@
package org.wildfly.extension.elytron;

import static org.wildfly.extension.elytron.ClassLoadingAttributeDefinitions.CLASS_NAME;
import static org.wildfly.extension.elytron.ClassLoadingAttributeDefinitions.MODULE;
import static org.wildfly.extension.elytron.ClassLoadingAttributeDefinitions.resolveClassLoader;
import static org.wildfly.extension.elytron.ElytronDefinition.commonDependencies;
import static org.wildfly.extension.elytron.ElytronExtension.asStringIfDefined;
Expand All @@ -40,6 +39,8 @@
import org.jboss.as.controller.OperationStepHandler;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.SimpleAttributeDefinition;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.as.controller.SimpleMapAttributeDefinition;
import org.jboss.as.controller.SimpleResourceDefinition;
import org.jboss.as.controller.capability.RuntimeCapability;
Expand All @@ -61,6 +62,10 @@
*/
class CustomComponentDefinition<T> extends SimpleResourceDefinition {

static final SimpleAttributeDefinition MODULE = new SimpleAttributeDefinitionBuilder(ClassLoadingAttributeDefinitions.MODULE)
.setRequired(true)
.build();

static final SimpleMapAttributeDefinition CONFIGURATION = new SimpleMapAttributeDefinition.Builder(ElytronDescriptionConstants.CONFIGURATION, ModelType.STRING, true)
.setAllowExpression(true)
.build();
Expand Down
2 changes: 1 addition & 1 deletion elytron/src/main/resources/schema/wildfly-elytron_1_0.xsd
Expand Up @@ -4560,7 +4560,7 @@
<xs:documentation>The attributes required for a custom component.
</xs:documentation>
</xs:annotation>
<xs:attribute name="module" type="xs:string">
<xs:attribute name="module" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>
The module to use to load the custom component.
Expand Down
Expand Up @@ -31,8 +31,8 @@
</filesystem-realm>
</security-realms>
<mappers>
<custom-permission-mapper class-name="org.wildfly.extension.elytron.DomainTestCase$MyPermissionMapper" name="MyPermissionMapper"/>
<custom-permission-mapper class-name="org.wildfly.extension.elytron.DomainTestCase$LoginPermissionMapper" name="LoginPermissionMapper"/>
<custom-permission-mapper class-name="org.wildfly.extension.elytron.DomainTestCase$MyPermissionMapper" name="MyPermissionMapper" module="a.b.c" />
<custom-permission-mapper class-name="org.wildfly.extension.elytron.DomainTestCase$LoginPermissionMapper" name="LoginPermissionMapper" module="a.b.c" />
<simple-permission-mapper name="SimplePermissionMapperRole">
<permission-mapping roles="role2">
<permission class-name="org.wildfly.security.auth.permission.LoginPermission"/>
Expand Down
Expand Up @@ -26,8 +26,8 @@
</properties-realm>
</security-realms>
<mappers>
<custom-permission-mapper name="PermissionMapper" class-name="org.wildfly.elytron.PermissionMapper" />
<custom-principal-decoder name="CustomPrincipalDecoder" class-name="org.wildfly.elytron.PrincipalDecoder" />
<custom-permission-mapper name="PermissionMapper" class-name="org.wildfly.elytron.PermissionMapper" module="a.b.c" />
<custom-principal-decoder name="CustomPrincipalDecoder" class-name="org.wildfly.elytron.PrincipalDecoder" module="a.b.c" />
<regex-principal-transformer name="RegexOne" pattern="a" replacement="b" />
<regex-principal-transformer name="RegexTwo" pattern="c" replacement="d" />
<regex-principal-transformer name="RegexThree" pattern="e" replacement="f" />
Expand Down
Expand Up @@ -13,6 +13,6 @@
</filesystem-realm>
</security-realms>
<mappers>
<custom-permission-mapper name="LoginPermissionMapper" class-name="org.wildfly.extension.elytron.IdentityOperationsTestCase$LoginPermissionMapper"/>
<custom-permission-mapper name="LoginPermissionMapper" class-name="org.wildfly.extension.elytron.IdentityOperationsTestCase$LoginPermissionMapper" module="a.b.c" />
</mappers>
</subsystem>
@@ -1,7 +1,7 @@
<subsystem xmlns="urn:wildfly:elytron:1.0">
<security-realms>
<aggregate-realm name="AggregateOne" authentication-realm="RealmThree" authorization-realm="RealmFour" />
<custom-realm name="CustomOne" class-name="org.wildfly.security.ElytronRealm" />
<custom-realm name="CustomOne" class-name="org.wildfly.security.ElytronRealm" module="a.b.c" />
<custom-realm name="CustomTwo" module="a.b.c" class-name="org.wildfly.security.ElytronRealm">
<configuration>
<property name="a" value="b" />
Expand Down

0 comments on commit 770074c

Please sign in to comment.