KEYCLOAK-3599 Add Script based OIDC ProtocolMapper

This commit is contained in:
Thomas Darimont committed 2017-09-22 21:24:20 +02:00
1 parent 15ddb2009d
commit 236b2b9273
5 files changed
+181 -5

No files matched your search

@@ -1779,11 +1779,11 @@ module.controller('ClientProtocolMapperCtrl', function($scope, realm, serverInfo
protocol: client.protocol,
mapper: angular.copy(mapper),
changed: false
}
};
var protocolMappers = serverInfo.protocolMapperTypes[client.protocol];
for (var i = 0; i < protocolMappers.length; i++) {
if (protocolMappers[i].id == mapper.protocolMapper) {
if (protocolMappers[i].id === mapper.protocolMapper) {
$scope.model.mapperType = protocolMappers[i];
}
}
@@ -1856,7 +1856,24 @@ module.controller('ClientProtocolMapperCreateCtrl', function($scope, realm, serv
mapper: { protocol : client.protocol, config: {}},
changed: false,
mapperTypes: serverInfo.protocolMapperTypes[protocol]
}
};
// apply default configurations on change for selected protocolmapper type.
$scope.$watch('model.mapperType', function() {
var currentMapperType = $scope.model.mapperType;
var defaultConfig = {};
if (currentMapperType && Array.isArray(currentMapperType.properties)) {
for (var i = 0; i < currentMapperType.properties.length; i++) {
var property = currentMapperType.properties[i];
if (property && property.name && property.defaultValue) {
defaultConfig[property.name] = property.defaultValue;
}
}
}
$scope.model.mapper.config = defaultConfig;
}, true);
$scope.model.mapperType = $scope.model.mapperTypes[0];