diff --git a/adapters/oidc/adapter-core/pom.xml b/adapters/oidc/adapter-core/pom.xml
index e97ca71dbf6..3509f9fef52 100755
--- a/adapters/oidc/adapter-core/pom.xml
+++ b/adapters/oidc/adapter-core/pom.xml
@@ -46,8 +46,6 @@
org.apache.http.impl.cookie.*;version=${apache.httpcomponents.fuse.version},
org.apache.http.impl.execchain.*;version=${apache.httpcomponents.fuse.version},
org.apache.http.*;version=${apache.httpcomponents.httpcore.fuse.version},
- org.apache.karaf.jaas.boot.principal;resolution:=optional,
- org.apache.karaf.jaas.modules;resolution:=optional,
*;resolution:=optional
diff --git a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/jaas/AbstractKeycloakLoginModule.java b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/jaas/AbstractKeycloakLoginModule.java
deleted file mode 100755
index 2a8dc151637..00000000000
--- a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/jaas/AbstractKeycloakLoginModule.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright 2016 Red Hat, Inc. and/or its affiliates
- * and other contributors as indicated by the @author tags.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.keycloak.adapters.jaas;
-
-import org.jboss.logging.Logger;
-import org.keycloak.KeycloakPrincipal;
-import org.keycloak.adapters.AdapterUtils;
-import org.keycloak.adapters.KeycloakDeployment;
-import org.keycloak.adapters.KeycloakDeploymentBuilder;
-import org.keycloak.adapters.RefreshableKeycloakSecurityContext;
-import org.keycloak.adapters.rotation.AdapterTokenVerifier;
-import org.keycloak.common.VerificationException;
-import org.keycloak.common.util.FindFile;
-import org.keycloak.common.util.reflections.Reflections;
-import org.keycloak.representations.AccessToken;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.spi.LoginModule;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.Principal;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * @author Marek Posolda
- */
-public abstract class AbstractKeycloakLoginModule implements LoginModule {
-
- public static final String KEYCLOAK_CONFIG_FILE_OPTION = "keycloak-config-file";
- public static final String ROLE_PRINCIPAL_CLASS_OPTION = "role-principal-class";
- public static final String PROFILE_RESOURCE = "profile:";
- protected Subject subject;
- protected CallbackHandler callbackHandler;
- protected Auth auth;
- protected KeycloakDeployment deployment;
- protected String rolePrincipalClass;
-
- // This is to avoid parsing keycloak.json file in each request. Key is file location, Value is parsed keycloak deployment
- private static ConcurrentMap deployments = new ConcurrentHashMap<>();
-
- @Override
- public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
- this.subject = subject;
- this.callbackHandler = callbackHandler;
-
- String configFile = (String)options.get(KEYCLOAK_CONFIG_FILE_OPTION);
- rolePrincipalClass = (String)options.get(ROLE_PRINCIPAL_CLASS_OPTION);
- getLogger().debug("Declared options: " + KEYCLOAK_CONFIG_FILE_OPTION + "=" + configFile + ", " + ROLE_PRINCIPAL_CLASS_OPTION + "=" + rolePrincipalClass);
-
- if (configFile != null) {
- deployment = deployments.get(configFile);
- if (deployment == null) {
- // lazy init of our deployment
- deployment = resolveDeployment(configFile);
- deployments.putIfAbsent(configFile, deployment);
- }
- }
- }
-
- protected KeycloakDeployment resolveDeployment(String keycloakConfigFile) {
- try {
- InputStream is = null;
- if (keycloakConfigFile.startsWith(PROFILE_RESOURCE)) {
- try {
- is = new URL(keycloakConfigFile).openStream();
- } catch (MalformedURLException mfue) {
- throw new RuntimeException(mfue);
- } catch (IOException ioe) {
- throw new RuntimeException(ioe);
- }
- } else {
- is = FindFile.findFile(keycloakConfigFile);
- }
- KeycloakDeployment kd = KeycloakDeploymentBuilder.build(is);
- return kd;
-
- } catch (RuntimeException e) {
- getLogger().debug("Unable to find or parse file " + keycloakConfigFile + " due to " + e.getMessage(), e);
- throw e;
- }
- }
-
-
- @Override
- public boolean login() throws LoginException {
- // get username and password
- Callback[] callbacks = new Callback[2];
- callbacks[0] = new NameCallback("username");
- callbacks[1] = new PasswordCallback("password", false);
-
- try {
- callbackHandler.handle(callbacks);
- String username = ((NameCallback) callbacks[0]).getName();
- char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword();
- String password = new String(tmpPassword);
- ((PasswordCallback) callbacks[1]).clearPassword();
-
- Auth auth = doAuth(username, password);
- if (auth != null) {
- this.auth = auth;
- return true;
- } else {
- return false;
- }
- } catch (UnsupportedCallbackException uce) {
- getLogger().warn("Error: " + uce.getCallback().toString()
- + " not available to gather authentication information from the user");
- return false;
- } catch (Exception e) {
- LoginException le = new LoginException(e.toString());
- le.initCause(e);
- throw le;
- }
- }
-
-
- @Override
- public boolean commit() throws LoginException {
- if (auth == null) {
- return false;
- }
-
- this.subject.getPrincipals().add(auth.getPrincipal());
- this.subject.getPrivateCredentials().add(auth.getTokenString());
- if (auth.getRoles() != null) {
- for (String roleName : auth.getRoles()) {
- Principal rolePrinc = createRolePrincipal(roleName);
- this.subject.getPrincipals().add(rolePrinc);
- }
- }
-
- return true;
- }
-
-
- protected Principal createRolePrincipal(String roleName) {
- if (rolePrincipalClass != null && rolePrincipalClass.length() > 0) {
- try {
- Class clazz = Reflections.classForName(rolePrincipalClass, getClass().getClassLoader());
- Constructor constructor = clazz.getDeclaredConstructor(String.class);
- return constructor.newInstance(roleName);
- } catch (Exception e) {
- getLogger().warn("Unable to create declared roleClass " + rolePrincipalClass + " due to " + e.getMessage());
- }
- }
-
- // Fallback to default rolePrincipal class
- return new RolePrincipal(roleName);
- }
-
-
- @Override
- public boolean abort() throws LoginException {
- return true;
- }
-
- @Override
- public boolean logout() throws LoginException {
- Set principals = new HashSet(subject.getPrincipals());
- for (Principal principal : principals) {
- if (principal.getClass().equals(KeycloakPrincipal.class) || principal.getClass().equals(RolePrincipal.class)) {
- subject.getPrincipals().remove(principal);
- }
- }
- Set