Skip to content

Commit

Permalink
[squash] changed subsystem 3.0 community to 2.0 community
Browse files Browse the repository at this point in the history
  • Loading branch information
PrarthonaPaul committed Mar 13, 2024
1 parent 6773587 commit 979d371
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 39 deletions.
Expand Up @@ -16,7 +16,6 @@
enum ElytronOidcClientSubsystemModel implements SubsystemModel {
VERSION_1_0_0(1, 0, 0),
VERSION_2_0_0(2, 0, 0),
VERSION_3_0_0_COMMUNITY(3, 0, 0),
;
static final ElytronOidcClientSubsystemModel CURRENT = VERSION_2_0_0;

Expand Down
Expand Up @@ -9,19 +9,10 @@
import org.jboss.as.controller.AttributeMarshaller;
import org.jboss.as.controller.AttributeParser;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.ResourceDefinition;
import org.jboss.as.controller.ResourceRegistration;
import org.jboss.as.controller.SimpleAttributeDefinition;
import org.jboss.as.controller.SubsystemRegistration;
import org.jboss.as.controller.descriptions.ParentResourceDescriptionResolver;
import org.jboss.as.controller.descriptions.SubsystemResourceDescriptionResolver;
import org.jboss.as.controller.parsing.ParseUtils;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.dmr.ModelNode;
import org.jboss.staxmapper.XMLExtendedStreamReader;
import org.wildfly.subsystem.resource.ManagementResourceRegistrar;
import org.wildfly.subsystem.resource.ManagementResourceRegistrationContext;
import org.wildfly.subsystem.resource.ResourceDescriptor;
import org.wildfly.subsystem.resource.SubsystemResourceDefinitionRegistrar;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
Expand All @@ -30,23 +21,13 @@
* @author <a href="mailto:prpaul@redhat.com">Prarthona Paul</a>
*/

public class ElytronOidcClientSubsystemRegistrar implements SubsystemResourceDefinitionRegistrar {
public class ElytronOidcClientSubsystemRegistrar {

static final String NAME = "elytron-oidc-client";
static final PathElement PATH = SubsystemResourceDefinitionRegistrar.pathElement(NAME);
static final ParentResourceDescriptionResolver RESOLVER = new SubsystemResourceDescriptionResolver(NAME, ElytronOidcClientSubsystemRegistrar.class);
static final AttributeParser SIMPLE_ATTRIBUTE_PARSER = new AttributeElementParser();
static final AttributeMarshaller SIMPLE_ATTRIBUTE_MARSHALLER = new AttributeElementMarshaller();

@Override
public ManagementResourceRegistration register(SubsystemRegistration parent, ManagementResourceRegistrationContext context) {
parent.setHostCapable();
ManagementResourceRegistration registration = parent.registerSubsystemModel(ResourceDefinition.builder(ResourceRegistration.of(PATH), RESOLVER).build());
ResourceDescriptor descriptor = ResourceDescriptor.builder(RESOLVER).build();
ManagementResourceRegistrar.of(descriptor).register(registration);
return registration;
}

static class AttributeElementMarshaller extends AttributeMarshaller.AttributeElementMarshaller {
@Override
public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException {
Expand Down
Expand Up @@ -18,6 +18,8 @@
import org.jboss.as.controller.parsing.ExtensionParsingContext;
import org.jboss.as.controller.registry.ManagementResourceRegistration;

import java.util.EnumSet;

/**
* An {@link Extension} to add support for OpenID Connect.
*
Expand Down Expand Up @@ -55,8 +57,6 @@ public void initialize(ExtensionContext context) {
}

public void initializeParsers(ExtensionParsingContext context) {
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, ElytronOidcSubsystemSchema.VERSION_1_0.getNamespace().toString(), ElytronOidcSubsystemSchema.VERSION_1_0);
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, ElytronOidcSubsystemSchema.VERSION_2_0.getNamespace().toString(), ElytronOidcSubsystemSchema.VERSION_2_0);
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, ElytronOidcSubsystemSchema.VERSION_3_0_COMMUNITY.getNamespace().toString(), ElytronOidcSubsystemSchema.VERSION_3_0_COMMUNITY);
context.setSubsystemXmlMappings(SUBSYSTEM_NAME, EnumSet.allOf(ElytronOidcSubsystemSchema.class));
}
}
Expand Up @@ -39,10 +39,10 @@
public enum ElytronOidcSubsystemSchema implements PersistentSubsystemSchema<ElytronOidcSubsystemSchema> {
VERSION_1_0(1),
VERSION_2_0(2),
VERSION_3_0_COMMUNITY(3, 0, Stability.COMMUNITY),
VERSION_2_0_COMMUNITY(2, 0, Stability.COMMUNITY),
;

static final Map<Stability, ElytronOidcSubsystemSchema> CURRENT = Feature.map(EnumSet.of(VERSION_2_0, VERSION_3_0_COMMUNITY));
static final Map<Stability, ElytronOidcSubsystemSchema> CURRENT = Feature.map(EnumSet.of(VERSION_2_0, VERSION_2_0_COMMUNITY));

private final VersionedNamespace<IntVersion, ElytronOidcSubsystemSchema> namespace;

Expand Down
Expand Up @@ -16,7 +16,6 @@

import static org.wildfly.extension.elytron.oidc.ElytronOidcClientSubsystemModel.VERSION_1_0_0;
import static org.wildfly.extension.elytron.oidc.ElytronOidcClientSubsystemModel.VERSION_2_0_0;
import static org.wildfly.extension.elytron.oidc.ElytronOidcClientSubsystemModel.VERSION_3_0_0_COMMUNITY;
import static org.wildfly.extension.elytron.oidc.ElytronOidcDescriptionConstants.SECURE_SERVER;

public class ElytronOidcSubsystemTransformers implements ExtensionTransformerRegistration {
Expand All @@ -30,8 +29,6 @@ public String getSubsystemName() {
public void registerTransformers(SubsystemTransformerRegistration registration) {

ChainedTransformationDescriptionBuilder chainedBuilder = TransformationDescriptionBuilder.Factory.createChainedSubystemInstance(registration.getCurrentSubsystemVersion());
// 3.0.0 (WildFly 32) to 2.0.0 (WildFly 29)
from3(chainedBuilder);
// 2.0.0 (WildFly 29) to 1.0.0 (WildFly 28)
from2(chainedBuilder);

Expand All @@ -44,10 +41,4 @@ private static void from2(ChainedTransformationDescriptionBuilder chainedBuilder
builder.rejectChildResource(PathElement.pathElement(SECURE_SERVER));
}

private static void from3(ChainedTransformationDescriptionBuilder chainedBuilder) {
ResourceTransformationDescriptionBuilder builder = chainedBuilder.createBuilder(VERSION_3_0_0_COMMUNITY.getVersion(), VERSION_2_0_0.getVersion());
builder.addChildResource(PathElement.pathElement(SECURE_SERVER))
.getAttributeBuilder();
}

}
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:wildfly:elytron-oidc-client:community:3.0"
xmlns="urn:wildfly:elytron-oidc-client:community:3.0"
targetNamespace="urn:wildfly:elytron-oidc-client:community:2.0"
xmlns="urn:wildfly:elytron-oidc-client:community:2.0"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1.0">
Expand Down
Expand Up @@ -3,7 +3,7 @@
~ SPDX-License-Identifier: Apache-2.0
-->

<subsystem xmlns="urn:wildfly:elytron-oidc-client:community:3.0">
<subsystem xmlns="urn:wildfly:elytron-oidc-client:community:2.0">
<realm name="main">
<realm-public-key>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4siLKUew0WYxdtq6/rwk4Uj/4amGFFnE/yzIxQVU0PUqz3QBRVkUWpDj0K6ZnS5nzJV/y6DHLEy7hjZTdRDphyF1sq09aDOYnVpzu8o2sIlMM8q5RnUyEfIyUZqwo8pSZDJ90fS0s+IDUJNCSIrAKO3w1lqZDHL6E/YFHXyzkvQIDAQAB</realm-public-key>
<auth-server-url>http://localhost:8080/auth</auth-server-url>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -541,7 +541,7 @@
<version.org.opensaml.opensaml>4.2.0</version.org.opensaml.opensaml>
<version.org.ow2.asm>9.6</version.org.ow2.asm>
<version.org.reactivestreams>1.0.4</version.org.reactivestreams>
<version.org.wildfly.core>24.0.0.Beta3-SNAPSHOT</version.org.wildfly.core>
<version.org.wildfly.core>24.0.0.Beta2</version.org.wildfly.core>
<version.org.wildfly.http-client>2.0.7.Final</version.org.wildfly.http-client>
<preview.version.org.wildfly.mvc.krazo>0.8.2.Final</preview.version.org.wildfly.mvc.krazo>
<version.org.wildfly.naming-client>2.0.1.Final</version.org.wildfly.naming-client>
Expand Down

0 comments on commit 979d371

Please sign in to comment.