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() {
return {};
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ApplicationDetailCtrl'
@ -592,6 +595,9 @@ module.config([ '$routeProvider', function($routeProvider) {
},
application : function(ApplicationLoader) {
return ApplicationLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
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');
$scope.accessTypes = [
@ -420,10 +420,8 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
"bearer-only"
];
$scope.protocols = [
"openid-connect",
"saml"
];
$scope.protocols = serverInfo.protocols;
$scope.signatureAlgorithms = [
"RSA_SHA1",
"RSA_SHA256",
@ -451,11 +449,9 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
} else if (application.publicClient) {
$scope.accessType = $scope.accessTypes[1];
}
if (application.protocol == 'openid-connect') {
$scope.protocol = $scope.protocols[0];
} else if (application.protocol == 'saml') {
$scope.protocol = $scope.protocols[1];
} else { // protocol could be null due to older keycloak installs
if (application.protocol) {
$scope.protocol = $scope.protocols[$scope.protocols.indexOf(application.protocol)];
} else {
$scope.protocol = $scope.protocols[0];
}
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.ThemeProvider;
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.util.ProviderLoader;
@ -37,6 +40,7 @@ public class ServerInfoAdminResource {
setSocialProviders(info);
setThemes(info);
setEventListeners(info);
setProtocols(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 {
private String version;
@ -76,6 +91,8 @@ public class ServerInfoAdminResource {
private Map<String, List<String>> themes;
private List<String> socialProviders;
private List<String> protocols;
private List<String> applicationImporters;
private List<String> eventListeners;
@ -102,6 +119,14 @@ public class ServerInfoAdminResource {
public List<String> getEventListeners() {
return eventListeners;
}
public List<String> getProtocols() {
return protocols;
}
public List<String> getApplicationImporters() {
return applicationImporters;
}
}
}