add mapper category and help text
This commit is contained in:
parent
8533d49dfb
commit
07b038e126
16 changed files with 116 additions and 22 deletions
|
@ -9,6 +9,8 @@ import java.util.List;
|
|||
public class ProtocolMapperTypeRepresentation {
|
||||
protected String id;
|
||||
protected String name;
|
||||
protected String category;
|
||||
protected String helpText;
|
||||
|
||||
public static class ConfigProperty {
|
||||
protected String name;
|
||||
|
@ -58,6 +60,22 @@ public class ProtocolMapperTypeRepresentation {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getHelpText() {
|
||||
return helpText;
|
||||
}
|
||||
|
||||
public void setHelpText(String helpText) {
|
||||
this.helpText = helpText;
|
||||
}
|
||||
|
||||
public List<ConfigProperty> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
|
|
@ -1091,11 +1091,14 @@ module.controller('ApplicationProtocolMapperCtrl', function($scope, realm, appli
|
|||
$http, $location, Dialog, Notifications) {
|
||||
$scope.realm = realm;
|
||||
$scope.application = application;
|
||||
if (application.protocol == null) {
|
||||
application.protocol = 'openid-connect';
|
||||
}
|
||||
|
||||
var protocolMappers = serverInfo.protocolMapperTypes[application.protocol];
|
||||
var mapperTypes = {};
|
||||
for (var i = 0; i < protocolMappers.length; i++) {
|
||||
mapperTypes[protocolMappers[i].id] = protocolMappers[i].name;
|
||||
mapperTypes[protocolMappers[i].id] = protocolMappers[i];
|
||||
}
|
||||
$scope.mapperTypes = mapperTypes;
|
||||
|
||||
|
@ -1135,11 +1138,14 @@ module.controller('AddApplicationProtocolMapperCtrl', function($scope, realm, ap
|
|||
$http, $location, Dialog, Notifications) {
|
||||
$scope.realm = realm;
|
||||
$scope.application = application;
|
||||
if (application.protocol == null) {
|
||||
application.protocol = 'openid-connect';
|
||||
}
|
||||
|
||||
var protocolMapperTypes = serverInfo.protocolMapperTypes[application.protocol];
|
||||
var protocolMappers = serverInfo.protocolMapperTypes[application.protocol];
|
||||
var mapperTypes = {};
|
||||
for (var i = 0; i < protocolMapperTypes.length; i++) {
|
||||
mapperTypes[protocolMapperTypes[i].id] = protocolMapperTypes[i].name;
|
||||
for (var i = 0; i < protocolMappers.length; i++) {
|
||||
mapperTypes[protocolMappers[i].id] = protocolMappers[i];
|
||||
}
|
||||
$scope.mapperTypes = mapperTypes;
|
||||
|
||||
|
|
|
@ -13,10 +13,8 @@ module.controller('ProtocolMapperListCtrl', function($scope, realm, serverInfo,
|
|||
$scope.protocol = protocol;
|
||||
var protocolMappers = serverInfo.protocolMapperTypes[protocol];
|
||||
var mapperTypes = {};
|
||||
if (protocolMappers) {
|
||||
for (var i = 0; i < protocolMappers.length; i++) {
|
||||
mapperTypes[protocolMappers[i].id] = protocolMappers[i].name;
|
||||
}
|
||||
for (var i = 0; i < protocolMappers.length; i++) {
|
||||
mapperTypes[protocolMappers[i].id] = protocolMappers[i];
|
||||
}
|
||||
$scope.mapperTypes = mapperTypes;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="kc-table-actions" colspan="3">
|
||||
<th class="kc-table-actions" colspan="4">
|
||||
<div class="search-comp clearfix">
|
||||
<input type="text" placeholder="Search..." class="form-control search" data-ng-model="search.name"
|
||||
onkeyup="if(event.keyCode == 13){$(this).next('button').click();}">
|
||||
|
@ -28,6 +28,7 @@
|
|||
</tr>
|
||||
<tr data-ng-hide="mappers.length == 0">
|
||||
<th>Name</th>
|
||||
<th>Category</th>
|
||||
<th>Type</th>
|
||||
<th>Add</th>
|
||||
</tr>
|
||||
|
@ -35,7 +36,8 @@
|
|||
<tbody>
|
||||
<tr ng-repeat="mapper in mappers | filter:search">
|
||||
<td><a href="#/realms/{{realm.realm}}/protocols/{{application.protocol}}/mappers/{{mapper.id}}">{{mapper.name}}</a></td>
|
||||
<td>{{mapperTypes[mapper.protocolMapper]}}</td>
|
||||
<td>{{mapperTypes[mapper.protocolMapper].category}}</td>
|
||||
<td>{{mapperTypes[mapper.protocolMapper].name}}</td>
|
||||
<td><input type="checkbox" ng-model="mapper.isChecked"></td>
|
||||
</tr>
|
||||
<tr data-ng-show="mappers.length == 0">
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="kc-table-actions" colspan="3">
|
||||
<th class="kc-table-actions" colspan="4">
|
||||
<div class="search-comp clearfix">
|
||||
<input type="text" placeholder="Search..." class="form-control search" data-ng-model="search.name"
|
||||
onkeyup="if(event.keyCode == 13){$(this).next('button').click();}">
|
||||
|
@ -29,6 +29,7 @@
|
|||
</tr>
|
||||
<tr data-ng-hide="mappers.length == 0">
|
||||
<th>Name</th>
|
||||
<th>Category</th>
|
||||
<th>Type</th>
|
||||
<th>Remove</th>
|
||||
</tr>
|
||||
|
@ -36,7 +37,8 @@
|
|||
<tbody>
|
||||
<tr ng-repeat="mapper in mappers | filter:search">
|
||||
<td><a href="#/realms/{{realm.realm}}/protocols/{{application.protocol}}/mappers/{{mapper.id}}">{{mapper.name}}</a></td>
|
||||
<td>{{mapperTypes[mapper.protocolMapper]}}</td>
|
||||
<td>{{mapperTypes[mapper.protocolMapper].category}}</td>
|
||||
<td>{{mapperTypes[mapper.protocolMapper].name}}</td>
|
||||
<td><input type="checkbox" ng-model="mapper.isChecked"></td>
|
||||
</tr>
|
||||
<tr data-ng-show="mappers.length == 0">
|
||||
|
|
|
@ -64,14 +64,14 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<span tooltip-placement="right" tooltip="'Confidential' applications require a secret to initiate login protocol. 'Public' clients do not require a secret. 'Bearer-only' applications are web services that never initiate a login." class="fa fa-info-circle"></span>
|
||||
<span tooltip-placement="right" tooltip="{{mapperType.helpText}}" class="fa fa-info-circle"></span>
|
||||
</div>
|
||||
<div class="form-group clearfix" data-ng-hide="create">
|
||||
<label class="col-sm-2 control-label" for="mapperType">Mapper Type</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" id="mapperType" type="text" ng-model="mapperType.name" data-ng-readonly="true">
|
||||
</div>
|
||||
<span tooltip-placement="right" tooltip="Name of the mapper." class="fa fa-info-circle"></span>
|
||||
<span tooltip-placement="right" tooltip="{{mapperType.helpText}}" class="fa fa-info-circle"></span>
|
||||
</div>
|
||||
<div data-ng-repeat="option in mapperType.properties" class="form-group">
|
||||
<label class="col-sm-2 control-label">{{option.label}} </label>
|
||||
|
|
|
@ -22,13 +22,15 @@
|
|||
</tr>
|
||||
<tr data-ng-hide="mappers.length == 0">
|
||||
<th>Name</th>
|
||||
<th>Category</th>
|
||||
<th>Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="mapper in mappers | filter:search">
|
||||
<td><a href="#/realms/{{realm.realm}}/protocols/{{protocol}}/mappers/{{mapper.id}}">{{mapper.name}}</a></td>
|
||||
<td>{{mapperTypes[mapper.protocolMapper]}}</td>
|
||||
<td>{{mapperTypes[mapper.protocolMapper].category}}</td>
|
||||
<td>{{mapperTypes[mapper.protocolMapper].name}}</td>
|
||||
</tr>
|
||||
<tr data-ng-show="mappers.length == 0">
|
||||
<td>No mappers available</td>
|
||||
|
|
|
@ -11,7 +11,9 @@ import java.util.List;
|
|||
*/
|
||||
public interface ProtocolMapper extends Provider, ProviderFactory<ProtocolMapper> {
|
||||
String getProtocol();
|
||||
String getDisplayCategory();
|
||||
String getDisplayType();
|
||||
String getHelpText();
|
||||
|
||||
public static class ConfigProperty {
|
||||
protected String name;
|
||||
|
|
|
@ -12,6 +12,8 @@ import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
|||
*/
|
||||
public abstract class AbstractOIDCProtocolMapper implements ProtocolMapper {
|
||||
|
||||
public static final String TOKEN_MAPPER_CATEGORY = "Token mapper";
|
||||
|
||||
@Override
|
||||
public String getProtocol() {
|
||||
return OIDCLoginProtocol.LOGIN_PROTOCOL;
|
||||
|
|
|
@ -39,7 +39,17 @@ public class OIDCAddressMapper extends AbstractOIDCProtocolMapper implements OID
|
|||
|
||||
@Override
|
||||
public String getDisplayType() {
|
||||
return "Address Mapper";
|
||||
return "User Address";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayCategory() {
|
||||
return TOKEN_MAPPER_CATEGORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() {
|
||||
return "Maps user address attributes (street, locality, region, postal_code, and country) to the OpenID Connect 'address' claim.";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,7 +46,17 @@ public class OIDCClientSessionNoteMapper extends AbstractOIDCProtocolMapper impl
|
|||
|
||||
@Override
|
||||
public String getDisplayType() {
|
||||
return "ClientSession Note Mapper";
|
||||
return "ClientSession Note";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayCategory() {
|
||||
return TOKEN_MAPPER_CATEGORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() {
|
||||
return "Map a temporary note that is attached to the ClientSession to a token claim.";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,7 +38,17 @@ public class OIDCFullNameMapper extends AbstractOIDCProtocolMapper implements OI
|
|||
|
||||
@Override
|
||||
public String getDisplayType() {
|
||||
return "Full name Mapper";
|
||||
return "User's full name";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayCategory() {
|
||||
return TOKEN_MAPPER_CATEGORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() {
|
||||
return "Maps the user's first and last name to the OpenID Connect 'name' claim. Format is <first> + ' ' + <last>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -52,7 +52,17 @@ public class OIDCUserAttributeMapper extends AbstractOIDCProtocolMapper implemen
|
|||
|
||||
@Override
|
||||
public String getDisplayType() {
|
||||
return "UserModel Attribute Mapper";
|
||||
return "User Attribute";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayCategory() {
|
||||
return TOKEN_MAPPER_CATEGORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() {
|
||||
return "Map a custom user attribute to a token claim.";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.List;
|
|||
*/
|
||||
public class OIDCUserModelMapper extends AbstractOIDCProtocolMapper implements OIDCAccessTokenMapper {
|
||||
private static final List<ConfigProperty> configProperties = new ArrayList<ConfigProperty>();
|
||||
public static final String USER_MODEL_PROPERTY = "UserModel Property";
|
||||
public static final String USER_MODEL_PROPERTY = "User Property";
|
||||
|
||||
static {
|
||||
ConfigProperty property;
|
||||
|
@ -51,7 +51,17 @@ public class OIDCUserModelMapper extends AbstractOIDCProtocolMapper implements O
|
|||
|
||||
@Override
|
||||
public String getDisplayType() {
|
||||
return "UserModel Property Mapper";
|
||||
return "User Property";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayCategory() {
|
||||
return TOKEN_MAPPER_CATEGORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() {
|
||||
return "Map a built in user property to a token claim.";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,7 +47,17 @@ public class OIDCUserSessionNoteMapper extends AbstractOIDCProtocolMapper implem
|
|||
|
||||
@Override
|
||||
public String getDisplayType() {
|
||||
return "UserSession Note Mapper";
|
||||
return "UserSession Note";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayCategory() {
|
||||
return TOKEN_MAPPER_CATEGORY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() {
|
||||
return "Map a temporary note that is attached to the UserSession to a token claim.";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -143,6 +143,8 @@ public class ServerInfoAdminResource {
|
|||
ProtocolMapperTypeRepresentation rep = new ProtocolMapperTypeRepresentation();
|
||||
rep.setId(mapper.getId());
|
||||
rep.setName(mapper.getDisplayType());
|
||||
rep.setHelpText(mapper.getHelpText());
|
||||
rep.setCategory(mapper.getDisplayCategory());
|
||||
rep.setProperties(new LinkedList<ProtocolMapperTypeRepresentation.ConfigProperty>());
|
||||
for (ProtocolMapper.ConfigProperty prop : mapper.getConfigProperties()) {
|
||||
ProtocolMapperTypeRepresentation.ConfigProperty propRep = new ProtocolMapperTypeRepresentation.ConfigProperty();
|
||||
|
|
Loading…
Reference in a new issue