publish protocol support

This commit is contained in:
Bill Burke 2014-10-24 11:25:04 -04:00
parent 1be070e34d
commit 971f0f5c16
3 changed files with 37 additions and 10 deletions

View file

@ -577,6 +577,9 @@ module.config([ '$routeProvider', function($routeProvider) {
}, },
application : function() { application : function() {
return {}; return {};
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
} }
}, },
controller : 'ApplicationDetailCtrl' controller : 'ApplicationDetailCtrl'
@ -592,6 +595,9 @@ module.config([ '$routeProvider', function($routeProvider) {
}, },
application : function(ApplicationLoader) { application : function(ApplicationLoader) {
return ApplicationLoader(); return ApplicationLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
} }
}, },
controller : 'ApplicationDetailCtrl' controller : 'ApplicationDetailCtrl'

View file

@ -411,7 +411,7 @@ module.controller('ApplicationInstallationCtrl', function($scope, realm, applica
} }
}); });
module.controller('ApplicationDetailCtrl', function($scope, realm, application, Application, $location, Dialog, Notifications) { module.controller('ApplicationDetailCtrl', function($scope, realm, application, serverInfo, Application, $location, Dialog, Notifications) {
console.log('ApplicationDetailCtrl'); console.log('ApplicationDetailCtrl');
$scope.accessTypes = [ $scope.accessTypes = [
@ -420,10 +420,8 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
"bearer-only" "bearer-only"
]; ];
$scope.protocols = [ $scope.protocols = serverInfo.protocols;
"openid-connect",
"saml"
];
$scope.signatureAlgorithms = [ $scope.signatureAlgorithms = [
"RSA_SHA1", "RSA_SHA1",
"RSA_SHA256", "RSA_SHA256",
@ -451,11 +449,9 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
} else if (application.publicClient) { } else if (application.publicClient) {
$scope.accessType = $scope.accessTypes[1]; $scope.accessType = $scope.accessTypes[1];
} }
if (application.protocol == 'openid-connect') { if (application.protocol) {
$scope.protocol = $scope.protocols[0]; $scope.protocol = $scope.protocols[$scope.protocols.indexOf(application.protocol)];
} else if (application.protocol == 'saml') { } else {
$scope.protocol = $scope.protocols[1];
} else { // protocol could be null due to older keycloak installs
$scope.protocol = $scope.protocols[0]; $scope.protocol = $scope.protocols[0];
} }
if (application.attributes['saml.signature.algorithm'] == 'RSA_SHA1') { if (application.attributes['saml.signature.algorithm'] == 'RSA_SHA1') {

View file

@ -5,6 +5,9 @@ import org.keycloak.events.EventListenerProvider;
import org.keycloak.freemarker.Theme; import org.keycloak.freemarker.Theme;
import org.keycloak.freemarker.ThemeProvider; import org.keycloak.freemarker.ThemeProvider;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.protocol.LoginProtocol;
import org.keycloak.protocol.LoginProtocolFactory;
import org.keycloak.provider.ProviderFactory;
import org.keycloak.social.SocialProvider; import org.keycloak.social.SocialProvider;
import org.keycloak.util.ProviderLoader; import org.keycloak.util.ProviderLoader;
@ -37,6 +40,7 @@ public class ServerInfoAdminResource {
setSocialProviders(info); setSocialProviders(info);
setThemes(info); setThemes(info);
setEventListeners(info); setEventListeners(info);
setProtocols(info);
return info; return info;
} }
@ -69,6 +73,17 @@ public class ServerInfoAdminResource {
} }
} }
private void setProtocols(ServerInfoRepresentation info) {
info.protocols = new LinkedList<String>();
for (ProviderFactory p : session.getKeycloakSessionFactory().getProviderFactories(LoginProtocol.class)) {
info.protocols.add(p.getId());
}
Collections.sort(info.protocols);
}
public static class ServerInfoRepresentation { public static class ServerInfoRepresentation {
private String version; private String version;
@ -76,6 +91,8 @@ public class ServerInfoAdminResource {
private Map<String, List<String>> themes; private Map<String, List<String>> themes;
private List<String> socialProviders; private List<String> socialProviders;
private List<String> protocols;
private List<String> applicationImporters;
private List<String> eventListeners; private List<String> eventListeners;
@ -102,6 +119,14 @@ public class ServerInfoAdminResource {
public List<String> getEventListeners() { public List<String> getEventListeners() {
return eventListeners; return eventListeners;
} }
public List<String> getProtocols() {
return protocols;
}
public List<String> getApplicationImporters() {
return applicationImporters;
}
} }
} }