KEYCLOAK-12526: Add 'Always Display in Console' to admin console

This commit is contained in:
Stan Silvert 2020-01-07 14:07:19 -05:00 committed by Bruno Oliveira da Silva
parent 648c6f811c
commit 568b1586a6
8 changed files with 29 additions and 2 deletions

View file

@ -556,6 +556,7 @@ public class ClientTest extends AbstractAdminTest {
if (client.getClientId() != null) Assert.assertEquals(client.getClientId(), storedClient.getClientId());
if (client.getName() != null) Assert.assertEquals(client.getName(), storedClient.getName());
if (client.isEnabled() != null) Assert.assertEquals(client.isEnabled(), storedClient.isEnabled());
if (client.isAlwaysDisplayInConsole() != null) Assert.assertEquals(client.isAlwaysDisplayInConsole(), storedClient.isAlwaysDisplayInConsole());
if (client.isBearerOnly() != null) Assert.assertEquals(client.isBearerOnly(), storedClient.isBearerOnly());
if (client.isPublicClient() != null) Assert.assertEquals(client.isPublicClient(), storedClient.isPublicClient());
if (client.isFullScopeAllowed() != null) Assert.assertEquals(client.isFullScopeAllowed(), storedClient.isFullScopeAllowed());

View file

@ -106,6 +106,7 @@
<configuration>
<systemProperties>
<keycloak.theme.dir>${keycloak.theme.dir}</keycloak.theme.dir>
<keycloak.profile.feature.account2>enabled</keycloak.profile.feature.account2>
</systemProperties>
</configuration>
</plugin>

View file

@ -33,6 +33,9 @@ public class ClientSettingsForm extends CreateClientForm {
@FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='enabled']]")
private OnOffSwitch enabledSwitch;
@FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='alwaysDisplayInConsole']]")
private OnOffSwitch alwaysDisplayInConsole;
@FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='consentRequired']]")
private OnOffSwitch consentRequiredSwitch;
@ -145,6 +148,14 @@ public class ClientSettingsForm extends CreateClientForm {
public void setEnabled(boolean enabled) {
enabledSwitch.setOn(enabled);
}
public boolean isAlwaysDisplayInConsole() {
return alwaysDisplayInConsole.isOn();
}
public void setAlwaysDisplayInConsole(boolean enabled) {
alwaysDisplayInConsole.setOn(enabled);
}
public boolean isConsentRequired() {
return consentRequiredSwitch.isOn();

View file

@ -105,6 +105,7 @@ public abstract class AbstractClientTest extends AbstractConsoleTest {
assertEqualsStringAttributes(c1.getClientId(), c2.getClientId());
assertEqualsStringAttributes(c1.getName(), c2.getName());
assertEqualsBooleanAttributes(c1.isEnabled(), c2.isEnabled());
assertEqualsBooleanAttributes(c1.isAlwaysDisplayInConsole(), c2.isAlwaysDisplayInConsole());
assertEqualsStringAttributes(c1.getBaseUrl(), c2.getBaseUrl());
assertEqualsBooleanAttributes(c1.isConsentRequired(), c2.isConsentRequired());
assertEqualsStringAttributes(c1.getProtocol(), c2.getProtocol());

View file

@ -47,7 +47,7 @@ public class ClientSettingsTest extends AbstractClientTest {
private ClientSettings clientSettingsPage;
private ClientRepresentation newClient;
@Test
public void crudOIDCPublic() {
newClient = createClientRep("oidc-public", OIDC);
@ -61,6 +61,7 @@ public class ClientSettingsTest extends AbstractClientTest {
// update & verify
newClient.setClientId("oidc-public-updated");
newClient.setName("updatedName");
newClient.setAlwaysDisplayInConsole(true);
List<String> redirectUris = new ArrayList<>();
redirectUris.add("http://example2.test/app/*");
@ -76,6 +77,7 @@ public class ClientSettingsTest extends AbstractClientTest {
clientSettingsPage.form().setClientId("oidc-public-updated");
clientSettingsPage.form().setName("updatedName");
clientSettingsPage.form().setAlwaysDisplayInConsole(true);
clientSettingsPage.form().setRedirectUris(redirectUris);
clientSettingsPage.form().setWebOrigins(webOrigins);
clientSettingsPage.form().save();

View file

@ -280,6 +280,8 @@ clear-import=Clear import
client-id.tooltip=Specifies ID referenced in URI and tokens. For example 'my-client'. For SAML this is also the expected issuer value from authn requests
client.name.tooltip=Specifies display name of the client. For example 'My Client'. Supports keys for localized values as well. For example\: ${my_client}
client.enabled.tooltip=Disabled clients cannot initiate a login or have obtain access tokens.
alwaysDisplayInConsole=Always Display in Console
alwaysDisplayInConsole.tooltip=Always list this client in the Account Console, even if the user does not have an active session.
consent-required=Consent Required
consent-required.tooltip=If enabled, users have to consent to client access.
client.display-on-consent-screen=Display Client On Consent Screen

View file

@ -683,7 +683,7 @@ module.controller('ClientRoleDetailCtrl', function($scope, $route, realm, client
$scope.create = !role.name;
$scope.changed = $scope.create;
$scope.save = function() {
convertAttributeValuesToLists();
if ($scope.create) {
@ -967,6 +967,7 @@ module.controller('ClientInstallationCtrl', function($scope, realm, client, serv
module.controller('ClientDetailCtrl', function($scope, realm, client, flows, $route, serverInfo, Client, ClientDescriptionConverter, Components, ClientStorageOperations, $location, $modal, Dialog, Notifications, TimeUnit2) {
$scope.serverInfo = serverInfo;
$scope.flows = [];
$scope.clientFlows = [];
var emptyFlow = {
@ -1279,6 +1280,7 @@ module.controller('ClientDetailCtrl', function($scope, realm, client, flows, $ro
} else if ($scope.accessType == "bearer-only") {
$scope.clientEdit.bearerOnly = true;
$scope.clientEdit.publicClient = false;
$scope.clientEdit.alwaysDisplayInConsole = false;
}
};

View file

@ -37,6 +37,13 @@
</div>
<kc-tooltip>{{:: 'client.enabled.tooltip' | translate}}</kc-tooltip>
</div>
<div class="form-group clearfix block" data-ng-show="serverInfo.featureEnabled('ACCOUNT2') && accessType !== 'bearer-only'">
<label class="col-md-2 control-label" for="alwaysDisplayInConsole">{{:: 'alwaysDisplayInConsole' | translate}}</label>
<div class="col-sm-6">
<input ng-model="clientEdit.alwaysDisplayInConsole" name="alwaysDisplayInConsole" id="alwaysDisplayInConsole" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/>
</div>
<kc-tooltip>{{:: 'alwaysDisplayInConsole.tooltip' | translate}}</kc-tooltip>
</div>
<div class="form-group clearfix block" data-ng-show="client.origin">
<label class="col-md-2 control-label">{{:: 'client-origin-link' | translate}}</label>
<div class="col-md-6">