keycloak-aplcache

KEYCLOAK-1017 Add server version to cached resources to prevent

2/25/2015 11:03:01 AM

Changes

Details

diff --git a/core/src/main/java/org/keycloak/Version.java b/core/src/main/java/org/keycloak/Version.java
index a1efa64..7b2c94f 100755
--- a/core/src/main/java/org/keycloak/Version.java
+++ b/core/src/main/java/org/keycloak/Version.java
@@ -12,6 +12,7 @@ import java.util.Properties;
  */
 public class Version {
     public static String VERSION;
+    public static String RESOURCES_VERSION;
     public static String BUILD_TIME;
     public static final String UNKNOWN = "UNKNOWN";
     public static final Version SINGLETON;
@@ -26,6 +27,7 @@ public class Version {
             props.load(is);
             VERSION = props.getProperty("version");
             BUILD_TIME = props.getProperty("build-time");
+            RESOURCES_VERSION = VERSION.toLowerCase();
         } catch (IOException e) {
             VERSION=UNKNOWN;
             BUILD_TIME=UNKNOWN;
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js
index 054c218..b398b83 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js
@@ -6,13 +6,12 @@ consoleBaseUrl = consoleBaseUrl + "/console";
 var configUrl = consoleBaseUrl + "/config";
 
 var auth = {};
-var authUrl = window.location.href.substring(0, window.location.href.indexOf('/admin/'));
 
 var module = angular.module('keycloak', [ 'keycloak.services', 'keycloak.loaders', 'ui.bootstrap', 'ui.select2', 'angularFileUpload' ]);
 var resourceRequests = 0;
 var loadingTimer = -1;
 
-angular.element(document).ready(function ($http) {
+angular.element(document).ready(function () {
     var keycloakAuth = new Keycloak(configUrl);
 
     keycloakAuth.onAuthLogout = function() {
@@ -58,27 +57,15 @@ module.factory('authInterceptor', function($q, Auth) {
 
 module.config([ '$routeProvider', function($routeProvider) {
     $routeProvider
-        /*
         .when('/create/realm', {
-            templateUrl : 'partials/realm-detail.html',
-            resolve : {
-                realm : function(RealmLoader) {
-                    return {};
-                }
-            },
-            controller : 'RealmDetailCtrl'
-        })
-        */
-
-        .when('/create/realm', {
-            templateUrl : 'partials/realm-create.html',
+            templateUrl : resourceUrl + '/partials/realm-create.html',
             resolve : {
 
             },
             controller : 'RealmCreateCtrl'
         })
         .when('/realms/:realm', {
-            templateUrl : 'partials/realm-detail.html',
+            templateUrl : resourceUrl + '/partials/realm-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -90,7 +77,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmDetailCtrl'
         })
         .when('/realms/:realm/login-settings', {
-            templateUrl : 'partials/realm-login-settings.html',
+            templateUrl : resourceUrl + '/partials/realm-login-settings.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -102,7 +89,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmLoginSettingsCtrl'
         })
         .when('/realms/:realm/theme-settings', {
-            templateUrl : 'partials/realm-theme-settings.html',
+            templateUrl : resourceUrl + '/partials/realm-theme-settings.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -114,7 +101,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmThemeCtrl'
         })
         .when('/realms/:realm/cache-settings', {
-            templateUrl : 'partials/realm-cache-settings.html',
+            templateUrl : resourceUrl + '/partials/realm-cache-settings.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -126,11 +113,11 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmCacheCtrl'
         })
         .when('/realms', {
-            templateUrl : 'partials/realm-list.html',
+            templateUrl : resourceUrl + '/partials/realm-list.html',
             controller : 'RealmListCtrl'
         })
         .when('/realms/:realm/token-settings', {
-            templateUrl : 'partials/realm-tokens.html',
+            templateUrl : resourceUrl + '/partials/realm-tokens.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -139,7 +126,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmTokenDetailCtrl'
         })
         .when('/realms/:realm/keys-settings', {
-            templateUrl : 'partials/realm-keys.html',
+            templateUrl : resourceUrl + '/partials/realm-keys.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -148,7 +135,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmKeysDetailCtrl'
         })
         .when('/realms/:realm/identity-provider-settings', {
-            templateUrl : 'partials/realm-identity-provider.html',
+            templateUrl : resourceUrl + '/partials/realm-identity-provider.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -166,7 +153,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmIdentityProviderCtrl'
         })
         .when('/create/identity-provider/:realm/:provider_id', {
-            templateUrl : function(params){ return 'partials/realm-identity-provider-' + params.provider_id + '.html'; },
+            templateUrl : function(params){ return resourceUrl + '/partials/realm-identity-provider-' + params.provider_id + '.html'; },
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -202,7 +189,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmIdentityProviderCtrl'
         })
         .when('/realms/:realm/default-roles', {
-            templateUrl : 'partials/realm-default-roles.html',
+            templateUrl : resourceUrl + '/partials/realm-default-roles.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -217,7 +204,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmDefaultRolesCtrl'
         })
         .when('/realms/:realm/required-credentials', {
-            templateUrl : 'partials/realm-credentials.html',
+            templateUrl : resourceUrl + '/partials/realm-credentials.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -226,7 +213,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmRequiredCredentialsCtrl'
         })
         .when('/realms/:realm/smtp-settings', {
-            templateUrl : 'partials/realm-smtp.html',
+            templateUrl : resourceUrl + '/partials/realm-smtp.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -235,7 +222,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmSMTPSettingsCtrl'
         })
         .when('/realms/:realm/events', {
-            templateUrl : 'partials/realm-events.html',
+            templateUrl : resourceUrl + '/partials/realm-events.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -244,7 +231,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmEventsCtrl'
         })
         .when('/realms/:realm/events-settings', {
-            templateUrl : 'partials/realm-events-config.html',
+            templateUrl : resourceUrl + '/partials/realm-events-config.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -259,7 +246,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmEventsConfigCtrl'
         })
         .when('/create/user/:realm', {
-            templateUrl : 'partials/user-detail.html',
+            templateUrl : resourceUrl + '/partials/user-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -271,7 +258,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'UserDetailCtrl'
         })
         .when('/realms/:realm/users/:user', {
-            templateUrl : 'partials/user-detail.html',
+            templateUrl : resourceUrl + '/partials/user-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -283,7 +270,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'UserDetailCtrl'
         })
         .when('/realms/:realm/users/:user/user-credentials', {
-            templateUrl : 'partials/user-credentials.html',
+            templateUrl : resourceUrl + '/partials/user-credentials.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -295,7 +282,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'UserCredentialsCtrl'
         })
         .when('/realms/:realm/users/:user/role-mappings', {
-            templateUrl : 'partials/role-mappings.html',
+            templateUrl : resourceUrl + '/partials/role-mappings.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -310,7 +297,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'UserRoleMappingCtrl'
         })
         .when('/realms/:realm/users/:user/sessions', {
-            templateUrl : 'partials/user-sessions.html',
+            templateUrl : resourceUrl + '/partials/user-sessions.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -325,7 +312,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'UserSessionsCtrl'
         })
         .when('/realms/:realm/users/:user/federated-identity', {
-            templateUrl : 'partials/user-federated-identity.html',
+            templateUrl : resourceUrl + '/partials/user-federated-identity.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -340,7 +327,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'UserFederatedIdentityCtrl'
         })
         .when('/realms/:realm/users', {
-            templateUrl : 'partials/user-list.html',
+            templateUrl : resourceUrl + '/partials/user-list.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -350,7 +337,7 @@ module.config([ '$routeProvider', function($routeProvider) {
         })
 
         .when('/create/role/:realm', {
-            templateUrl : 'partials/role-detail.html',
+            templateUrl : resourceUrl + '/partials/role-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -368,7 +355,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RoleDetailCtrl'
         })
         .when('/realms/:realm/roles/:role', {
-            templateUrl : 'partials/role-detail.html',
+            templateUrl : resourceUrl + '/partials/role-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -386,7 +373,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RoleDetailCtrl'
         })
         .when('/realms/:realm/roles', {
-            templateUrl : 'partials/role-list.html',
+            templateUrl : resourceUrl + '/partials/role-list.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -399,7 +386,7 @@ module.config([ '$routeProvider', function($routeProvider) {
         })
 
         .when('/create/role/:realm/applications/:application', {
-            templateUrl : 'partials/application-role-detail.html',
+            templateUrl : resourceUrl + '/partials/application-role-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -420,7 +407,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationRoleDetailCtrl'
         })
         .when('/realms/:realm/applications/:application/roles/:role', {
-            templateUrl : 'partials/application-role-detail.html',
+            templateUrl : resourceUrl + '/partials/application-role-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -441,7 +428,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationRoleDetailCtrl'
         })
         .when('/realms/:realm/applications/:application/claims', {
-            templateUrl : 'partials/application-claims.html',
+            templateUrl : resourceUrl + '/partials/application-claims.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -456,7 +443,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationClaimsCtrl'
         })
         .when('/realms/:realm/applications/:application/sessions', {
-            templateUrl : 'partials/application-sessions.html',
+            templateUrl : resourceUrl + '/partials/application-sessions.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -471,7 +458,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationSessionsCtrl'
         })
         .when('/realms/:realm/applications/:application/credentials', {
-            templateUrl : 'partials/application-credentials.html',
+            templateUrl : resourceUrl + '/partials/application-credentials.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -483,7 +470,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationCredentialsCtrl'
         })
         .when('/realms/:realm/applications/:application/identity-provider', {
-            templateUrl : 'partials/application-identity-provider.html',
+            templateUrl : resourceUrl + '/partials/application-identity-provider.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -495,7 +482,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationIdentityProviderCtrl'
         })
         .when('/realms/:realm/applications/:application/clustering', {
-            templateUrl : 'partials/application-clustering.html',
+            templateUrl : resourceUrl + '/partials/application-clustering.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -507,7 +494,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationClusteringCtrl'
         })
         .when('/register-node/realms/:realm/applications/:application/clustering', {
-            templateUrl : 'partials/application-clustering-node.html',
+            templateUrl : resourceUrl + '/partials/application-clustering-node.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -519,7 +506,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationClusteringNodeCtrl'
         })
         .when('/realms/:realm/applications/:application/clustering/:node', {
-            templateUrl : 'partials/application-clustering-node.html',
+            templateUrl : resourceUrl + '/partials/application-clustering-node.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -531,7 +518,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationClusteringNodeCtrl'
         })
         .when('/realms/:realm/applications/:application/saml/keys', {
-            templateUrl : 'partials/application-saml-keys.html',
+            templateUrl : resourceUrl + '/partials/application-saml-keys.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -543,7 +530,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationSamlKeyCtrl'
         })
         .when('/realms/:realm/applications/:application/saml/:keyType/import/:attribute', {
-            templateUrl : 'partials/application-saml-key-import.html',
+            templateUrl : resourceUrl + '/partials/application-saml-key-import.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -555,7 +542,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationCertificateImportCtrl'
         })
         .when('/realms/:realm/applications/:application/saml/:keyType/export/:attribute', {
-            templateUrl : 'partials/application-saml-key-export.html',
+            templateUrl : resourceUrl + '/partials/application-saml-key-export.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -567,7 +554,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationCertificateExportCtrl'
         })
         .when('/realms/:realm/applications/:application/roles', {
-            templateUrl : 'partials/application-role-list.html',
+            templateUrl : resourceUrl + '/partials/application-role-list.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -582,7 +569,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationRoleListCtrl'
         })
         .when('/realms/:realm/applications/:application/revocation', {
-            templateUrl : 'partials/application-revocation.html',
+            templateUrl : resourceUrl + '/partials/application-revocation.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -594,7 +581,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationRevocationCtrl'
         })
         .when('/realms/:realm/applications/:application/scope-mappings', {
-            templateUrl : 'partials/application-scope-mappings.html',
+            templateUrl : resourceUrl + '/partials/application-scope-mappings.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -609,7 +596,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationScopeMappingCtrl'
         })
         .when('/realms/:realm/applications/:application/installation', {
-            templateUrl : 'partials/application-installation.html',
+            templateUrl : resourceUrl + '/partials/application-installation.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -621,7 +608,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationInstallationCtrl'
         })
         .when('/create/application/:realm', {
-            templateUrl : 'partials/application-detail.html',
+            templateUrl : resourceUrl + '/partials/application-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -639,7 +626,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationDetailCtrl'
         })
         .when('/realms/:realm/applications/:application', {
-            templateUrl : 'partials/application-detail.html',
+            templateUrl : resourceUrl + '/partials/application-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -657,7 +644,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationDetailCtrl'
         })
         .when('/realms/:realm/applications', {
-            templateUrl : 'partials/application-list.html',
+            templateUrl : resourceUrl + '/partials/application-list.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -673,7 +660,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'ApplicationListCtrl'
         })
         .when('/import/application/:realm', {
-            templateUrl : 'partials/application-import.html',
+            templateUrl : resourceUrl + '/partials/application-import.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -688,7 +675,7 @@ module.config([ '$routeProvider', function($routeProvider) {
         // OAUTH Client
 
         .when('/realms/:realm/oauth-clients/:oauth/claims', {
-            templateUrl : 'partials/oauth-client-claims.html',
+            templateUrl : resourceUrl + '/partials/oauth-client-claims.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -703,7 +690,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'OAuthClientClaimsCtrl'
         })
         .when('/realms/:realm/oauth-clients/:oauth/revocation', {
-            templateUrl : 'partials/oauth-client-revocation.html',
+            templateUrl : resourceUrl + '/partials/oauth-client-revocation.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -715,7 +702,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'OAuthClientRevocationCtrl'
         })
         .when('/realms/:realm/oauth-clients/:oauth/credentials', {
-            templateUrl : 'partials/oauth-client-credentials.html',
+            templateUrl : resourceUrl + '/partials/oauth-client-credentials.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -727,7 +714,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'OAuthClientCredentialsCtrl'
         })
         .when('/realms/:realm/oauth-clients/:oauth/scope-mappings', {
-            templateUrl : 'partials/oauth-client-scope-mappings.html',
+            templateUrl : resourceUrl + '/partials/oauth-client-scope-mappings.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -742,7 +729,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'OAuthClientScopeMappingCtrl'
         })
         .when('/realms/:realm/oauth-clients/:oauth/installation', {
-            templateUrl : 'partials/oauth-client-installation.html',
+            templateUrl : resourceUrl + '/partials/oauth-client-installation.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -757,7 +744,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'OAuthClientInstallationCtrl'
         })
         .when('/create/oauth-client/:realm', {
-            templateUrl : 'partials/oauth-client-detail.html',
+            templateUrl : resourceUrl + '/partials/oauth-client-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -769,7 +756,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'OAuthClientDetailCtrl'
         })
         .when('/realms/:realm/oauth-clients/:oauth', {
-            templateUrl : 'partials/oauth-client-detail.html',
+            templateUrl : resourceUrl + '/partials/oauth-client-detail.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -781,7 +768,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'OAuthClientDetailCtrl'
         })
         .when('/realms/:realm/oauth-clients/:oauth/identity-provider', {
-            templateUrl : 'partials/oauth-client-identity-provider.html',
+            templateUrl : resourceUrl + '/partials/oauth-client-identity-provider.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -793,7 +780,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'OAuthClientIdentityProviderCtrl'
         })
         .when('/realms/:realm/oauth-clients', {
-            templateUrl : 'partials/oauth-client-list.html',
+            templateUrl : resourceUrl + '/partials/oauth-client-list.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -806,11 +793,11 @@ module.config([ '$routeProvider', function($routeProvider) {
         })
 
         .when('/', {
-            templateUrl : 'partials/home.html',
+            templateUrl : resourceUrl + '/partials/home.html',
             controller : 'HomeCtrl'
         })
         .when('/mocks/:realm', {
-            templateUrl : 'partials/realm-detail_mock.html',
+            templateUrl : resourceUrl + '/partials/realm-detail_mock.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -822,7 +809,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmDetailCtrl'
         })
         .when('/realms/:realm/sessions/revocation', {
-            templateUrl : 'partials/session-revocation.html',
+            templateUrl : resourceUrl + '/partials/session-revocation.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -831,7 +818,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmRevocationCtrl'
         })
          .when('/realms/:realm/sessions/realm', {
-            templateUrl : 'partials/session-realm.html',
+            templateUrl : resourceUrl + '/partials/session-realm.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -843,7 +830,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmSessionStatsCtrl'
         })
         .when('/realms/:realm/user-federation', {
-            templateUrl : 'partials/user-federation.html',
+            templateUrl : resourceUrl + '/partials/user-federation.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -852,7 +839,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'UserFederationCtrl'
         })
         .when('/realms/:realm/user-federation/providers/ldap/:instance', {
-            templateUrl : 'partials/federated-ldap.html',
+            templateUrl : resourceUrl + '/partials/federated-ldap.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -864,7 +851,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'LDAPCtrl'
         })
         .when('/create/user-federation/:realm/providers/ldap', {
-            templateUrl : 'partials/federated-ldap.html',
+            templateUrl : resourceUrl + '/partials/federated-ldap.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -876,7 +863,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'LDAPCtrl'
         })
         .when('/realms/:realm/user-federation/providers/kerberos/:instance', {
-            templateUrl : 'partials/federated-kerberos.html',
+            templateUrl : resourceUrl + '/partials/federated-kerberos.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -891,7 +878,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'GenericUserFederationCtrl'
         })
         .when('/create/user-federation/:realm/providers/kerberos', {
-            templateUrl : 'partials/federated-kerberos.html',
+            templateUrl : resourceUrl + '/partials/federated-kerberos.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -906,7 +893,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'GenericUserFederationCtrl'
         })
         .when('/create/user-federation/:realm/providers/:provider', {
-            templateUrl : 'partials/federated-generic.html',
+            templateUrl : resourceUrl + '/partials/federated-generic.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -923,7 +910,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'GenericUserFederationCtrl'
         })
         .when('/realms/:realm/user-federation/providers/:provider/:instance', {
-            templateUrl : 'partials/federated-generic.html',
+            templateUrl : resourceUrl + '/partials/federated-generic.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -938,7 +925,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'GenericUserFederationCtrl'
         })
         .when('/realms/:realm/defense/headers', {
-            templateUrl : 'partials/defense-headers.html',
+            templateUrl : resourceUrl + '/partials/defense-headers.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -951,7 +938,7 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'DefenseHeadersCtrl'
         })
         .when('/realms/:realm/defense/brute-force', {
-            templateUrl : 'partials/brute-force.html',
+            templateUrl : resourceUrl + '/partials/brute-force.html',
             resolve : {
                 realm : function(RealmLoader) {
                     return RealmLoader();
@@ -960,14 +947,14 @@ module.config([ '$routeProvider', function($routeProvider) {
             controller : 'RealmBruteForceCtrl'
         })
         .when('/server-info', {
-            templateUrl : 'partials/server-info.html'
+            templateUrl : resourceUrl + '/partials/server-info.html'
         })
         .when('/logout', {
-            templateUrl : 'partials/home.html',
+            templateUrl : resourceUrl + '/partials/home.html',
             controller : 'LogoutCtrl'
         })
         .otherwise({
-            templateUrl : 'partials/notfound.html'
+            templateUrl : resourceUrl + '/partials/notfound.html'
         });
 } ]);
 
@@ -1291,7 +1278,7 @@ module.directive('kcDropdown', function ($compile, Notifications) {
         },
         restrict: 'EA',
         replace: true,
-        templateUrl: 'templates/kc-select.html',
+        templateUrl: resourceUrl + '/templates/kc-select.html',
         link: function(scope, element, attr) {
             scope.updateModel = function(item) {
                 scope.kcModel = item;
@@ -1345,7 +1332,7 @@ module.directive('kcNavigation', function ($compile, Notifications) {
         scope: true,
         restrict: 'E',
         replace: true,
-        templateUrl: 'templates/kc-navigation.html',
+        templateUrl: resourceUrl + '/templates/kc-navigation.html',
 
         compile: function(element, attrs){
             if (!attrs.kcSocial) {
@@ -1360,7 +1347,7 @@ module.directive('kcNavigationApplication', function () {
         scope: true,
         restrict: 'E',
         replace: true,
-        templateUrl: 'templates/kc-navigation-application.html',
+        templateUrl: resourceUrl + '/templates/kc-navigation-application.html',
     }
 });
 
@@ -1369,7 +1356,7 @@ module.directive('kcNavigationOauthClient', function () {
         scope: true,
         restrict: 'E',
         replace: true,
-        templateUrl: 'templates/kc-navigation-oauth-client.html',
+        templateUrl: resourceUrl + '/templates/kc-navigation-oauth-client.html',
     }
 });
 
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/realm.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/realm.js
index 52b313a..140cbbe 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/realm.js
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/realm.js
@@ -4,6 +4,7 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, WhoAmI, Current, $
     };
 
     $scope.authUrl = authUrl;
+    $scope.resourceUrl = resourceUrl;
     $scope.auth = Auth;
     $scope.serverInfo = ServerInfo.get();
     $scope.serverInfoUpdate = function() {
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js
index 2c50ff7..d131b50 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js
@@ -20,7 +20,7 @@ module.service('Dialog', function($modal) {
         };
 
         return $modal.open({
-            templateUrl: 'templates/kc-modal.html',
+            templateUrl: resourceUrl + '/templates/kc-modal.html',
             controller: controller,
             resolve: {
                 title: function() {
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-claims.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-claims.html
index a01bc3c..d23887c 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-claims.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-claims.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
@@ -9,7 +9,7 @@
         </ol>
         <h2 data-ng-hide="create"><span>{{application.name}}</span> Allowed Claims <span tooltip-placement="right" tooltip="Allows you to restrict which claim information is stored in the access token generated for the application." class="fa fa-info-circle"></span></h2>
         <form class="form-horizontal" name="claimForm">
-            <div data-ng-include data-src="'partials/claims.html'"></div>
+            <div data-ng-include data-src="resourceUrl + '/partials/claims.html'"></div>
             <div class="pull-right form-actions" data-ng-show="access.manageApplications">
                 <button kc-reset data-ng-show="changed">Clear changes</button>
                 <button kc-save  data-ng-show="changed">Save</button>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-clustering.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-clustering.html
index 3d5c850..985260f 100644
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-clustering.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-clustering.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-clustering-node.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-clustering-node.html
index c456ac2..74ef211 100644
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-clustering-node.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-clustering-node.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-credentials.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-credentials.html
index f5b33e4..1d9ab88 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-credentials.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-credentials.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-detail.html
index 1f6b838..a317db0 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-detail.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-detail.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-identity-provider.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-identity-provider.html
index 94d79be..57adcd3 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-identity-provider.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-identity-provider.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-import.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-import.html
index 723bf01..4399d3c 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-import.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-import.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li class="active"><a href="">Application Import</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-installation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-installation.html
index e70db27..5a98483 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-installation.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-installation.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
 
     <kc-navigation-application></kc-navigation-application>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-keys.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-keys.html
index b8b232d..1acaa54 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-keys.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-keys.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-list.html
index 27a7d92..92bb4af 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-list.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-list.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <h2></h2>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-revocation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-revocation.html
index 7430b50..41e8c11 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-revocation.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-revocation.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-detail.html
index 48d290d..5145f37 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-detail.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-detail.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-list.html
index b9b7011..e10126e 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-list.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-role-list.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
 
     <kc-navigation-application></kc-navigation-application>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-key-export.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-key-export.html
index 692080a..2431612 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-key-export.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-key-export.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-key-import.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-key-import.html
index e72583e..63e5a96 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-key-import.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-key-import.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-keys.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-keys.html
index f871bb9..5d9ba63 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-keys.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-saml-keys.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-scope-mappings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-scope-mappings.html
index 19c69d5..852f1f4 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-scope-mappings.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-scope-mappings.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
 
     <kc-navigation-application></kc-navigation-application>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-sessions.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-sessions.html
index 10ee5a5..3284c3a 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-sessions.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/application-sessions.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-application></kc-navigation-application>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/brute-force.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/brute-force.html
index 46ad5b5..f9d5373 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/brute-force.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/brute-force.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf"  data-ng-show="!create">
         <li><a href="#/realms/{{realm.realm}}/defense/headers">Headers</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/defense-headers.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/defense-headers.html
index 67fa0db..194268f 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/defense-headers.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/defense-headers.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li class="active"><a href="#/realms/{{realm.realm}}/defense/headers">Headers</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-generic.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-generic.html
index c504eac..431b392 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-generic.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-generic.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li><a href="#/realms/{{realm.realm}}/users">User List</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-kerberos.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-kerberos.html
index 1b30221..fe26e8f 100644
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-kerberos.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-kerberos.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li><a href="#/realms/{{realm.realm}}/users">User List</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-ldap.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-ldap.html
index 35323a6..418ba07 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-ldap.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-ldap.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li><a href="#/realms/{{realm.realm}}/users">User List</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html
index 997dac6..f330226 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-claims.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-oauth-client></kc-navigation-oauth-client>
     <div id="content">
@@ -9,7 +9,7 @@
         </ol>
         <h2 data-ng-hide="create"><span>{{oauth.name}}</span> Allowed Claims <span tooltip-placement="right" tooltip="Allows you to restrict which claim information is stored in the access token generated for the application." class="fa fa-info-circle"></span></h2>
         <form class="form-horizontal" name="claimForm">
-            <div data-ng-include data-src="'partials/claims.html'"></div>
+            <div data-ng-include data-src="resourceUrl + '/partials/claims.html'"></div>
             <div class="pull-right form-actions" data-ng-show="access.manageClients">
                 <button kc-reset data-ng-show="changed">Clear changes</button>
                 <button kc-save  data-ng-show="changed">Save</button>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-credentials.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-credentials.html
index f83faf4..9b5db34 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-credentials.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-credentials.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <kc-navigation-oauth-client></kc-navigation-oauth-client>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html
index 1fea625..46daf9f 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-detail.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-oauth-client></kc-navigation-oauth-client>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-identity-provider.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-identity-provider.html
index 1a14620..92f3e87 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-identity-provider.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-identity-provider.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-oauth-client></kc-navigation-oauth-client>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html
index 15ba1de..5a8cd4f 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-installation.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-oauth-client></kc-navigation-oauth-client>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html
index 16eef5c..ebf59a4 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-list.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <h2></h2>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html
index b36082f..1af3caf 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-revocation.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-oauth-client></kc-navigation-oauth-client>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html
index 788525c..f137b5d 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/oauth-client-scope-mappings.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <kc-navigation-oauth-client></kc-navigation-oauth-client>
     <div id="content">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-cache-settings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-cache-settings.html
index ddc1b88..2567173 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-cache-settings.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-cache-settings.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <kc-navigation data-kc-current="general" data-kc-realm="realm.realm" data-kc-social="social"></kc-navigation>
     <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-credentials.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-credentials.html
index 1f0e9f5..6dff85c 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-credentials.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-credentials.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <data-kc-navigation data-kc-current="credentials" data-kc-realm="realm.realm" data-kc-social="realm.social"></data-kc-navigation>
     <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-default-roles.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-default-roles.html
index a13e544..d2207f7 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-default-roles.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-default-roles.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li><a href="#/realms/{{realm.realm}}/roles">Realm Roles</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-detail.html
index d431bda..80f8e13 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-detail.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-detail.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <kc-navigation data-kc-current="general" data-kc-realm="realm.realm" data-kc-social="social"></kc-navigation>
     <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-events.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-events.html
index ad3a433..7a66013 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-events.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-events.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
 
     <ul class="nav nav-tabs nav-tabs-pf">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-events-config.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-events-config.html
index 1a0e607..9ce707b 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-events-config.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-events-config.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
 
     <ul class="nav nav-tabs nav-tabs-pf">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider.html
index 175b8cb..ab7cfa4 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <data-kc-navigation data-kc-current="social" data-kc-realm="realm.realm" data-kc-social="realm.social"></data-kc-navigation>
     <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-facebook.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-facebook.html
index d565cfb..a4630ac 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-facebook.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-facebook.html
@@ -1 +1 @@
-<div data-ng-include data-src="'partials/realm-identity-provider-social.html'"></div>
\ No newline at end of file
+<div data-ng-include data-src="resourceUrl + '/partials/realm-identity-provider-social.html'"></div>
\ No newline at end of file
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-github.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-github.html
index d565cfb..a4630ac 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-github.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-github.html
@@ -1 +1 @@
-<div data-ng-include data-src="'partials/realm-identity-provider-social.html'"></div>
\ No newline at end of file
+<div data-ng-include data-src="resourceUrl + '/partials/realm-identity-provider-social.html'"></div>
\ No newline at end of file
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-google.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-google.html
index d565cfb..a4630ac 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-google.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-google.html
@@ -1 +1 @@
-<div data-ng-include data-src="'partials/realm-identity-provider-social.html'"></div>
\ No newline at end of file
+<div data-ng-include data-src="resourceUrl + '/partials/realm-identity-provider-social.html'"></div>
\ No newline at end of file
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-oidc.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-oidc.html
index 8680ac1..d33ffad 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-oidc.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-oidc.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
     <div id="content-area" class="col-sm-9" role="main">
         <data-kc-navigation data-kc-current="social" data-kc-realm="realm.realm" data-kc-social="realm.social"></data-kc-navigation>
         <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-saml.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-saml.html
index 2f08e48..af51a48 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-saml.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-saml.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
     <div id="content-area" class="col-sm-9" role="main" data-ng-init="initSamlProvider()">
         <data-kc-navigation data-kc-current="social" data-kc-realm="realm.realm" data-kc-social="realm.social"></data-kc-navigation>
         <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-social.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-social.html
index 3e33cc6..d0aadec 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-social.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-social.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
     <div id="content-area" class="col-sm-9" role="main">
         <data-kc-navigation data-kc-current="social" data-kc-realm="realm.realm" data-kc-social="realm.social"></data-kc-navigation>
         <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-twitter.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-twitter.html
index d565cfb..a4630ac 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-twitter.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-identity-provider-twitter.html
@@ -1 +1 @@
-<div data-ng-include data-src="'partials/realm-identity-provider-social.html'"></div>
\ No newline at end of file
+<div data-ng-include data-src="resourceUrl + '/partials/realm-identity-provider-social.html'"></div>
\ No newline at end of file
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html
index 52ccfca..ccccbae 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-keys.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <data-kc-navigation data-kc-current="keys" data-kc-realm="realm.realm" data-kc-social="realm.social"></data-kc-navigation>
     <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-login-settings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-login-settings.html
index ff318b0..bd1bab9 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-login-settings.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-login-settings.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <kc-navigation data-kc-current="general" data-kc-realm="realm.realm" data-kc-social="social"></kc-navigation>
     <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-smtp.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-smtp.html
index f19e3c4..fdbc33e 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-smtp.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-smtp.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <data-kc-navigation data-kc-current="email" data-kc-realm="realm.realm" data-kc-social="realm.social"></data-kc-navigation>
     <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-theme-settings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-theme-settings.html
index 2e6f1f7..c08d5f9 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-theme-settings.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-theme-settings.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <kc-navigation data-kc-current="general" data-kc-realm="realm.realm" data-kc-social="social"></kc-navigation>
     <h2></h2>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html
index b2833c9..c322bf2 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/realm-tokens.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf"  data-ng-show="!create">
         <li><a href="#/realms/{{realm.realm}}/sessions/realm">Realm Sessions</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-detail.html
index 06fa783..299b698 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-detail.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-detail.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
 
     <ul class="nav nav-tabs nav-tabs-pf">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-list.html
index 74a8670..17879ca 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-list.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-list.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li class="active"><a href="#/realms/{{realm.realm}}/roles">Realm Roles</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-mappings.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-mappings.html
index 6a07ca7..0ae08be 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-mappings.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/role-mappings.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf"  data-ng-show="!create">
         <li><a href="#/realms/{{realm.realm}}/users/{{user.username}}">Attributes</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-realm.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-realm.html
index 8730395..1394703 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-realm.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-realm.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li class="active"><a href="#/realms/{{realm.realm}}/sessions/realm">Realm Sessions</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-revocation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-revocation.html
index 866c6fb..c87af7f 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-revocation.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/session-revocation.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf"  data-ng-show="!create">
         <li><a href="#/realms/{{realm.realm}}/sessions/realm">Realm Sessions</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-credentials.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-credentials.html
index 0efd271..8ca73a6 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-credentials.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-credentials.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
 
     <ul class="nav nav-tabs nav-tabs-pf"  data-ng-show="!create">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html
index 5e770a8..8ed77b7 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
 
     <ul class="nav nav-tabs nav-tabs-pf" data-ng-show="!create">
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federated-identity.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federated-identity.html
index 845be1f..70a2691 100644
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federated-identity.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federated-identity.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li><a href="#/realms/{{realm.realm}}/users/{{user.username}}">Attributes</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html
index 0d7e4c6..d81ef0c 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-sm-3 " data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-sm-3 " data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-sm-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li><a href="#/realms/{{realm.realm}}/users">User List</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html
index 3fdd481..df50067 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-list.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li class="active"><a href="">User List</a></li>
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-sessions.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-sessions.html
index a2a8ee0..f3de7e4 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-sessions.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-sessions.html
@@ -1,4 +1,4 @@
-<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
+<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
 <div id="content-area" class="col-md-9" role="main">
     <ul class="nav nav-tabs nav-tabs-pf">
         <li><a href="#/realms/{{realm.realm}}/users/{{user.username}}">Attributes</a></li>
diff --git a/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java b/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java
index 7b4c1c9..ff6e0fc 100755
--- a/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java
+++ b/services/src/main/java/org/keycloak/services/resources/admin/AdminConsole.java
@@ -9,6 +9,8 @@ import org.jboss.resteasy.spi.NotFoundException;
 import org.keycloak.ClientConnection;
 import org.keycloak.Config;
 import org.keycloak.freemarker.BrowserSecurityHeaderSetup;
+import org.keycloak.freemarker.FreeMarkerException;
+import org.keycloak.freemarker.FreeMarkerUtil;
 import org.keycloak.freemarker.Theme;
 import org.keycloak.freemarker.ThemeProvider;
 import org.keycloak.models.AdminRoles;
@@ -24,6 +26,7 @@ import org.keycloak.services.managers.ApplicationManager;
 import org.keycloak.services.managers.AuthenticationManager;
 import org.keycloak.services.managers.RealmManager;
 import org.keycloak.services.resources.KeycloakApplication;
+import org.keycloak.services.resources.flows.Urls;
 import org.keycloak.util.MimeTypeUtil;
 
 import javax.ws.rs.GET;
@@ -33,9 +36,11 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.CacheControl;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 import javax.ws.rs.ext.Providers;
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -248,7 +253,7 @@ public class AdminConsole {
     @GET
     @NoCache
     public Response logout() {
-        URI redirect = AdminRoot.adminConsoleUrl(uriInfo).path("index.html").build(realm.getName());
+        URI redirect = AdminRoot.adminConsoleUrl(uriInfo).build(realm.getName());
 
         return Response.status(302).location(
                 OIDCLoginProtocolService.logoutUrl(uriInfo).queryParam("redirect_uri", redirect.toString()).build(realm.getName())
@@ -266,72 +271,41 @@ public class AdminConsole {
      * @throws URISyntaxException
      */
     @GET
-    public Response getMainPage() throws URISyntaxException {
+    @NoCache
+    public Response getMainPage() throws URISyntaxException, IOException, FreeMarkerException {
         if (!uriInfo.getRequestUri().getPath().endsWith("/")) {
             return Response.status(302).location(uriInfo.getRequestUriBuilder().path("/").build()).build();
         } else {
-            return getResource("index.html");
-        }
-    }
+            String adminTheme = realm.getAdminTheme();
+            if (adminTheme == null) {
+                adminTheme = "keycloak";
+            }
 
-    /**
-     * Javascript used by admin console
-     *
-     * @return
-     */
-    @GET
-    @Path("js/keycloak.js")
-    @Produces("text/javascript")
-    public Response getKeycloakJs() {
-        InputStream inputStream = getClass().getClassLoader().getResourceAsStream("keycloak.js");
-        if (inputStream != null) {
-            CacheControl cacheControl = new CacheControl();
-            cacheControl.setNoTransform(false);
-            cacheControl.setMaxAge(Config.scope("theme").getInt("staticMaxAge", -1));
-
-            return Response.ok(inputStream).type("text/javascript").cacheControl(cacheControl).build();
-        } else {
-            return Response.status(Response.Status.NOT_FOUND).build();
-        }
-    }
+            Map<String, String> map = new HashMap<String, String>();
 
-    /**
-     * Theme resources for this realm's admin console. (images, html files, etc..)
-     *
-     * @param path
-     * @return
-     */
-    @GET
-    @Path("{path:.+}")
-    public Response getResource(@PathParam("path") String path) {
-        // todo
-        // I don't know why I need this.  On IE 11, if I don't have this, getKeycloakJs() isn't invoked
-        // I just can't figure out what the difference is between IE11 and FF for console/js/keycloak.js calls
-        if (path.equals("js/keycloak.js")) {
-            return getKeycloakJs();
-        }
+            URI baseUri = uriInfo.getBaseUri();
+
+            String authUrl = baseUri.toString();
+            authUrl = authUrl.substring(0, authUrl.length() - 1);
+
+            map.put("authUrl", authUrl);
+            map.put("resourceUrl", Urls.themeRoot(baseUri) + "/admin/" + adminTheme);
 
-        try {
             ThemeProvider themeProvider = session.getProvider(ThemeProvider.class, "extending");
             Theme theme = themeProvider.getTheme(realm.getAdminTheme(), Theme.Type.ADMIN);
-            InputStream resource = theme.getResourceAsStream(path);
-            if (resource != null) {
-                String contentType = MimeTypeUtil.getContentType(path);
-
-                CacheControl cacheControl = new CacheControl();
-                cacheControl.setNoTransform(false);
-                cacheControl.setMaxAge(Config.scope("theme").getInt("staticMaxAge", -1));
-
-                Response.ResponseBuilder builder = Response.ok(resource).type(contentType).cacheControl(cacheControl);
-                BrowserSecurityHeaderSetup.headers(builder, realm);
-                return builder.build();
-            } else {
-                return Response.status(Response.Status.NOT_FOUND).build();
-            }
-        } catch (Exception e) {
-            logger.warn("Failed to get theme resource", e);
-            return Response.serverError().build();
+
+            FreeMarkerUtil freeMarkerUtil = new FreeMarkerUtil();
+            String result = freeMarkerUtil.processTemplate(map, "index.ftl", theme);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK).type(MediaType.TEXT_HTML).entity(result);
+            BrowserSecurityHeaderSetup.headers(builder, realm);
+            return builder.build();
         }
     }
 
+    @GET
+    @Path("index.html")
+    public Response getIndexHtmlRedirect() {
+        return Response.status(302).location(uriInfo.getRequestUriBuilder().path("../").build()).build();
+    }
+
 }
diff --git a/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java
index 2ac929d..6952e88 100755
--- a/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/admin/ServerInfoAdminResource.java
@@ -1,5 +1,6 @@
 package org.keycloak.services.resources.admin;
 
+import org.jboss.resteasy.annotations.cache.Cache;
 import org.keycloak.Version;
 import org.keycloak.broker.provider.IdentityProvider;
 import org.keycloak.broker.provider.IdentityProviderFactory;
diff --git a/services/src/main/java/org/keycloak/services/resources/flows/Urls.java b/services/src/main/java/org/keycloak/services/resources/flows/Urls.java
index 2eb1ed4..7889388 100755
--- a/services/src/main/java/org/keycloak/services/resources/flows/Urls.java
+++ b/services/src/main/java/org/keycloak/services/resources/flows/Urls.java
@@ -22,6 +22,7 @@
 package org.keycloak.services.resources.flows;
 
 import org.keycloak.OAuth2Constants;
+import org.keycloak.Version;
 import org.keycloak.protocol.oidc.OIDCLoginProtocol;
 import org.keycloak.protocol.oidc.OIDCLoginProtocolService;
 import org.keycloak.services.resources.AccountService;
@@ -190,7 +191,7 @@ public class Urls {
     }
 
     public static URI themeRoot(URI baseUri) {
-        return themeBase(baseUri).build();
+        return themeBase(baseUri).path(Version.RESOURCES_VERSION).build();
     }
 
     private static UriBuilder requiredActionsBase(URI baseUri) {
diff --git a/services/src/main/java/org/keycloak/services/resources/ThemeResource.java b/services/src/main/java/org/keycloak/services/resources/ThemeResource.java
index 2021ed8..488774d 100755
--- a/services/src/main/java/org/keycloak/services/resources/ThemeResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/ThemeResource.java
@@ -20,7 +20,7 @@ import java.io.InputStream;
  *
  * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
  */
-@Path("/theme")
+@Path("/resources")
 public class ThemeResource {
 
     private static final Logger logger = Logger.getLogger(ThemeResource.class);
@@ -37,7 +37,7 @@ public class ThemeResource {
      * @return
      */
     @GET
-    @Path("/{themeType}/{themeName}/{path:.*}")
+    @Path("/{version}/{themeType}/{themeName}/{path:.*}")
     public Response getResource(@PathParam("themeType") String themType, @PathParam("themeName") String themeName, @PathParam("path") String path) {
         try {
             ThemeProvider themeProvider = session.getProvider(ThemeProvider.class, "extending");