Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFCORE-7134] Remove ModuleIdentifier use in the elytron subsystem #6320

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
*/
package org.wildfly.extension.elytron;

import org.jboss.as.controller.ModuleIdentifierUtil;
import org.jboss.as.controller.SimpleAttributeDefinition;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.as.controller.StringListAttributeDefinition;
import org.jboss.dmr.ModelType;
import org.jboss.modules.Module;
import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoadException;

/**
Expand Down Expand Up @@ -43,8 +43,7 @@ class ClassLoadingAttributeDefinitions {
static ClassLoader resolveClassLoader(String module) throws ModuleLoadException {
Module current = Module.getCallerModule();
if (module != null && current != null) {
ModuleIdentifier mi = ModuleIdentifier.fromString(module);
current = current.getModule(mi);
current = current.getModule(ModuleIdentifierUtil.canonicalModuleIdentifier(module));
}

return current != null ? current.getClassLoader() : ClassLoadingAttributeDefinitions.class.getClassLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.jboss.as.controller.AbstractAddStepHandler;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.ModuleIdentifierUtil;
import org.jboss.as.controller.ObjectTypeAttributeDefinition;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
Expand All @@ -40,7 +41,6 @@
import org.jboss.dmr.ModelType;
import org.jboss.dmr.Property;
import org.jboss.modules.Module;
import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoadException;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController;
Expand Down Expand Up @@ -160,9 +160,8 @@ private static TrivialService.ValueSupplier<DirContextSupplier> obtainDirContext
if(moduleName != null && !"".equals(moduleName)){
try {
Module cm = Module.getCallerModule();
ModuleIdentifier mi = ModuleIdentifier.create(moduleName);
//module = Module.getCallerModule().getModule(ModuleIdentifier.create(moduleName));
module = cm.getModule(mi);
module = cm.getModule(ModuleIdentifierUtil.canonicalModuleIdentifier(moduleName));
} catch (ModuleLoadException e) {
throw ElytronSubsystemMessages.ROOT_LOGGER.unableToLoadModule(moduleName, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jboss.as.controller.AttributeParser;
import org.jboss.as.controller.AttributeParsers;
import org.jboss.as.controller.ModelVersion;
import org.jboss.as.controller.ModuleIdentifierUtil;
import org.jboss.as.controller.ObjectListAttributeDefinition;
import org.jboss.as.controller.ObjectTypeAttributeDefinition;
import org.jboss.as.controller.OperationContext;
Expand All @@ -41,7 +42,6 @@
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.jboss.modules.Module;
import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoadException;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
Expand Down Expand Up @@ -404,9 +404,8 @@ static Permissions createPermissions(List<Permission> permissionsList) throws St
private static java.security.Permission createPermission(Permission permission) throws StartException {
Module currentModule = Module.getCallerModule();
if (permission.getModule() != null && currentModule != null) {
ModuleIdentifier mi = ModuleIdentifier.fromString(permission.getModule());
try {
currentModule = currentModule.getModule(mi);
currentModule = currentModule.getModule(permission.getModule());
soul2zimate marked this conversation as resolved.
Show resolved Hide resolved
} catch (ModuleLoadException e) {
// If we cannot load it, it can never be checked.
throw ElytronSubsystemMessages.ROOT_LOGGER.invalidPermissionModule(permission.getModule(), e);
Expand All @@ -432,7 +431,7 @@ static class Permission {

Permission(final String className, final String module, final String targetName, final String action) {
this.className = className;
this.module = module;
this.module = module != null ? ModuleIdentifierUtil.canonicalModuleIdentifier(module) : module;
this.targetName = targetName;
this.action = action;
}
Expand Down
Loading