split up realm settings

This commit is contained in:
Bill Burke 2013-09-27 15:57:30 -04:00
parent 40d9e7b6f7
commit 86a2617799
12 changed files with 208 additions and 154 deletions

View file

@ -13,7 +13,7 @@ public class AllRoleMappingsRepresentation {
protected String username;
protected List<RoleRepresentation> realmMappings;
protected Map<String, ApplicationRoleMappings> applicationMappings;
protected Map<String, ApplicationRoleMappingsRepresentation> applicationMappings;
public String getRealmId() {
return realmId;
@ -47,11 +47,11 @@ public class AllRoleMappingsRepresentation {
this.realmMappings = realmMappings;
}
public Map<String,ApplicationRoleMappings> getApplicationMappings() {
public Map<String,ApplicationRoleMappingsRepresentation> getApplicationMappings() {
return applicationMappings;
}
public void setApplicationMappings(Map<String, ApplicationRoleMappings> applicationMappings) {
public void setApplicationMappings(Map<String, ApplicationRoleMappingsRepresentation> applicationMappings) {
this.applicationMappings = applicationMappings;
}
}

View file

@ -6,7 +6,7 @@ import java.util.List;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class ApplicationRoleMappings {
public class ApplicationRoleMappingsRepresentation {
protected String applicationId;
protected String application;
protected String username;

View file

@ -12,17 +12,17 @@ public class RealmRepresentation {
protected String self; // link
protected String id;
protected String realm;
protected int tokenLifespan;
protected int accessCodeLifespan;
protected int accessCodeLifespanUserAction;
protected boolean enabled;
protected boolean sslNotRequired;
protected boolean cookieLoginAllowed;
protected boolean registrationAllowed;
protected boolean verifyEmail;
protected boolean resetPasswordAllowed;
protected boolean social;
protected boolean automaticRegistrationAfterSocialLogin;
protected Integer tokenLifespan;
protected Integer accessCodeLifespan;
protected Integer accessCodeLifespanUserAction;
protected Boolean enabled;
protected Boolean sslNotRequired;
protected Boolean cookieLoginAllowed;
protected Boolean registrationAllowed;
protected Boolean verifyEmail;
protected Boolean resetPasswordAllowed;
protected Boolean social;
protected Boolean automaticRegistrationAfterSocialLogin;
protected String privateKey;
protected String publicKey;
protected List<RoleRepresentation> roles;
@ -93,35 +93,35 @@ public class RealmRepresentation {
this.applications = applications;
}
public boolean isEnabled() {
public Boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public boolean isSslNotRequired() {
public Boolean isSslNotRequired() {
return sslNotRequired;
}
public void setSslNotRequired(boolean sslNotRequired) {
public void setSslNotRequired(Boolean sslNotRequired) {
this.sslNotRequired = sslNotRequired;
}
public boolean isCookieLoginAllowed() {
public Boolean isCookieLoginAllowed() {
return cookieLoginAllowed;
}
public void setCookieLoginAllowed(boolean cookieLoginAllowed) {
public void setCookieLoginAllowed(Boolean cookieLoginAllowed) {
this.cookieLoginAllowed = cookieLoginAllowed;
}
public int getTokenLifespan() {
public Integer getTokenLifespan() {
return tokenLifespan;
}
public void setTokenLifespan(int tokenLifespan) {
public void setTokenLifespan(Integer tokenLifespan) {
this.tokenLifespan = tokenLifespan;
}
@ -185,19 +185,19 @@ public class RealmRepresentation {
this.requiredOAuthClientCredentials = requiredOAuthClientCredentials;
}
public int getAccessCodeLifespan() {
public Integer getAccessCodeLifespan() {
return accessCodeLifespan;
}
public void setAccessCodeLifespan(int accessCodeLifespan) {
public void setAccessCodeLifespan(Integer accessCodeLifespan) {
this.accessCodeLifespan = accessCodeLifespan;
}
public int getAccessCodeLifespanUserAction() {
public Integer getAccessCodeLifespanUserAction() {
return accessCodeLifespanUserAction;
}
public void setAccessCodeLifespanUserAction(int accessCodeLifespanUserAction) {
public void setAccessCodeLifespanUserAction(Integer accessCodeLifespanUserAction) {
this.accessCodeLifespanUserAction = accessCodeLifespanUserAction;
}
@ -233,43 +233,43 @@ public class RealmRepresentation {
this.publicKey = publicKey;
}
public boolean isRegistrationAllowed() {
public Boolean isRegistrationAllowed() {
return registrationAllowed;
}
public void setRegistrationAllowed(boolean registrationAllowed) {
public void setRegistrationAllowed(Boolean registrationAllowed) {
this.registrationAllowed = registrationAllowed;
}
public boolean isVerifyEmail() {
public Boolean isVerifyEmail() {
return verifyEmail;
}
public void setVerifyEmail(boolean verifyEmail) {
public void setVerifyEmail(Boolean verifyEmail) {
this.verifyEmail = verifyEmail;
}
public boolean isResetPasswordAllowed() {
public Boolean isResetPasswordAllowed() {
return resetPasswordAllowed;
}
public void setResetPasswordAllowed(boolean resetPassword) {
public void setResetPasswordAllowed(Boolean resetPassword) {
this.resetPasswordAllowed = resetPassword;
}
public boolean isSocial() {
public Boolean isSocial() {
return social;
}
public void setSocial(boolean social) {
public void setSocial(Boolean social) {
this.social = social;
}
public boolean isAutomaticRegistrationAfterSocialLogin() {
public Boolean isAutomaticRegistrationAfterSocialLogin() {
return automaticRegistrationAfterSocialLogin;
}
public void setAutomaticRegistrationAfterSocialLogin(boolean automaticRegistrationAfterSocialLogin) {
public void setAutomaticRegistrationAfterSocialLogin(Boolean automaticRegistrationAfterSocialLogin) {
this.automaticRegistrationAfterSocialLogin = automaticRegistrationAfterSocialLogin;
}
}

View file

@ -26,8 +26,24 @@ module.config([ '$routeProvider', function($routeProvider) {
}).when('/realms', {
templateUrl : 'partials/realm-list.html',
controller : 'RealmListCtrl'
}).when('/realms/:realm/token-settings', {
templateUrl : 'partials/realm-tokens.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'RealmTokenDetailCtrl'
})
.when('/realms/:realm/required-credentials', {
templateUrl : 'partials/realm-credentials.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'RealmRequiredCredentialsCtrl'
})
.when('/create/user/:realm', {
templateUrl : 'partials/user-detail.html',
resolve : {

View file

@ -64,15 +64,7 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
$scope.realm = {
enabled: true,
requireSsl: true,
cookieLoginAllowed: true,
tokenLifespan: 300,
tokenLifespanUnit: 'SECONDS',
accessCodeLifespan: 300,
accessCodeLifespanUnit: 'SECONDS',
requiredCredentials: ['password'],
requiredOAuthClientCredentials: ['password'],
requiredApplicationCredentials: ['password']
cookieLoginAllowed: true
};
} else {
if (Current.realm == null || Current.realm.id != realm.id) {
@ -90,21 +82,12 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
}
$scope.realm = angular.copy(realm);
$scope.realm.requireSsl = !realm.sslNotRequired;
$scope.realm.tokenLifespanUnit = 'SECONDS';
$scope.realm.accessCodeLifespanUnit = 'SECONDS';
}
var oldCopy = angular.copy($scope.realm);
$scope.userCredentialOptions = {
'multiple' : true,
'simple_tags' : true,
'tags' : ['password', 'totp', 'cert']
};
$scope.changed = $scope.create;
$scope.$watch('realm', function() {
@ -118,8 +101,6 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
var realmCopy = angular.copy($scope.realm);
realmCopy.sslNotRequired = !realmCopy.requireSsl;
delete realmCopy["requireSsl"];
delete realmCopy["tokenLifespanUnit"];
delete realmCopy["accessCodeLifespanUnit"];
if ($scope.createRealm) {
Realm.save(realmCopy, function(data, headers) {
console.log('creating new realm');
@ -180,6 +161,105 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
};
});
module.controller('RealmRequiredCredentialsCtrl', function($scope, Realm, realm, $http, $location, Dialog, Notifications) {
console.log('RealmRequiredCredentialsCtrl');
$scope.realm = {
id : realm.id, realm : realm.realm,
requiredCredentials : realm.requiredCredentials,
requiredApplicationCredentials : realm.requiredApplicationCredentials,
requiredOAuthClientCredentials : realm.requiredOAuthClientCredentials
};
$scope.userCredentialOptions = {
'multiple' : true,
'simple_tags' : true,
'tags' : ['password', 'totp', 'cert']
};
var oldCopy = angular.copy($scope.realm);
$scope.changed = false;
$scope.$watch('realm', function() {
if (!angular.equals($scope.realm, oldCopy)) {
$scope.changed = true;
}
}, true);
$scope.save = function() {
if ($scope.realmForm.$valid) {
var realmCopy = angular.copy($scope.realm);
$scope.changed = false;
Realm.update(realmCopy, function () {
$location.url("/realms/" + realm.id + "/required-credentials");
Notifications.success("Saved changes to realm");
});
} else {
$scope.realmForm.showErrors = true;
}
};
$scope.reset = function() {
$scope.realm = angular.copy(oldCopy);
$scope.changed = false;
$scope.realmForm.showErrors = false;
};
});
module.controller('RealmTokenDetailCtrl', function($scope, Realm, realm, $http, $location, Dialog, Notifications) {
console.log('RealmTokenDetailCtrl');
$scope.realm = { id : realm.id, realm : realm.realm, tokenLifespan : realm.tokenLifespan, accessCodeLifespan : realm.accessCodeLifespan };
$scope.realm.tokenLifespanUnit = 'Seconds';
$scope.realm.accessCodeLifespanUnit = 'Seconds';
var oldCopy = angular.copy($scope.realm);
$scope.changed = false;
$scope.$watch('realm', function() {
if (!angular.equals($scope.realm, oldCopy)) {
$scope.changed = true;
}
}, true);
$scope.save = function() {
if ($scope.realmForm.$valid) {
var realmCopy = angular.copy($scope.realm);
delete realmCopy["tokenLifespanUnit"];
delete realmCopy["accessCodeLifespanUnit"];
if ($scope.realm.tokenLifespanUnit == 'Minutes') {
realmCopy.tokenLifespan = $scope.realm.tokenLifespan * 60;
} else if ($scope.realm.tokenLifespanUnit == 'Hours') {
realmCopy.tokenLifespan = $scope.realm.tokenLifespan * 60 * 60;
} else if ($scope.realm.tokenLifespanUnit == 'Days') {
realmCopy.tokenLifespan = $scope.realm.tokenLifespan * 60 * 60 * 24;
}
if ($scope.realm.accessCodeLifespanUnit == 'Minutes') {
realmCopy.accessCodeLifespan = $scope.realm.accessCodeLifespan * 60;
} else if ($scope.realm.accessCodeLifespanUnit == 'Hours') {
realmCopy.accessCodeLifespan = $scope.realm.accessCodeLifespan * 60 * 60;
} else if ($scope.realm.accessCodeLifespanUnit == 'Days') {
realmCopy.accessCodeLifespan = $scope.realm.accessCodeLifespan * 60 * 60 * 24;
}
$scope.changed = false;
Realm.update(realmCopy, function () {
$location.url("/realms/" + realm.id + "/token-settings");
Notifications.success("Saved changes to realm");
});
} else {
$scope.realmForm.showErrors = true;
}
};
$scope.reset = function() {
$scope.realm = angular.copy(oldCopy);
$scope.changed = false;
$scope.realmForm.showErrors = false;
};
});
module.controller('UserListCtrl', function($scope, realm, User) {
$scope.realm = realm;

View file

@ -4,18 +4,19 @@
<div id="content-area" class="col-md-9" role="main">
<div class="top-nav" data-ng-hide="createRealm">
<ul class="rcue-tabs">
<li><a href="#">Settings</a></li>
<li><a href="#/realms/{{realm.id}}">Settings</a></li>
<li data-ng-show="realm.social"><a href="#">Social</a></li>
<li><a href="#">Roles</a></li>
<li class="active"><a href="#">Required Credentials</a></li>
<li><a href="#">Token Settings</a></li>
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li class="active"><a href="#/realms/{{realm.id}}/required-credentials">Required Credentials</a></li>
<li><a href="#/realms/{{realm.id}}/token-settings">Token Settings</a></li>
</ul>
</div>
<div id="content">
<h2 class="pull-left">Realm: <span>{{realm.realm}}</span></h2>
<p class="subtitle"></p>
<form name="realmForm" novalidate>
<fieldset>
<legend collapsed><span class="text">Required Credentials</span></legend>
<legend uncollapsed><span class="text">Required Credentials</span></legend>
<div class="form-group">
<label class="control-label">Required User Credentials</label>

View file

@ -7,8 +7,8 @@
<li class="active"><a href="#/realms/{{realm.id}}">Settings</a></li>
<li data-ng-show="realm.social"><a href="#">Social</a></li>
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li><a href="#">Required Credentials</a></li>
<li><a href="#">Token Settings</a></li>
<li><a href="#/realms/{{realm.id}}/required-credentials">Required Credentials</a></li>
<li><a href="#/realms/{{realm.id}}/token-settings">Token Settings</a></li>
</ul>
</div>
<div id="content">
@ -97,61 +97,6 @@
</div>
</div>
</fieldset>
<fieldset>
<legend collapsed><span class="text">Token Settings</span></legend>
<div class="form-group input-select">
<label for="tokenLifespan">Token lifespan</label>
<div class="input-group">
<input type="text" data-ng-model="realm.tokenLifespan" id="tokenLifespan" name="tokenLifespan" class="tiny">
<div class="select-rcue">
<select name="tokenLifespanUnit" data-ng-model="realm.tokenLifespanUnit">
<option data-ng-selected="!realm.tokenLifespanUnit">Seconds</option>
<option>Minutes</option>
<option>Hours</option>
<option>Days</option>
</select>
</div>
</div>
</div>
<div class="form-group input-select">
<label for="accessCodeLifespan">Access code lifespan</label>
<div class="input-group">
<input type="text" data-ng-model="realm.accessCodeLifespan" id="accessCodeLifespan" name="accessCodeLifespan" class="tiny">
<div class="select-rcue">
<select name="accessCodeLifespanUnit" data-ng-model="realm.accessCodeLifespanUnit">
<option data-ng-selected="!realm.accessCodeLifespanUnit">Seconds</option>
<option>Minutes</option>
<option>Hours</option>
<option>Days</option>
</select>
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend collapsed><span class="text">Default Credential Settings</span></legend>
<div class="form-group">
<label class="control-label">Required User Credentials</label>
<div class="controls">
<input style="width:250px" type="text" ui-select2="userCredentialOptions" ng-model="realm.requiredCredentials">
</div>
</div>
<div class="form-group">
<label class="control-label">Required Application Credentials</label>
<div class="controls">
<input style="width:250;height:25" type="text" ui-select2="userCredentialOptions" ng-model="realm.requiredApplicationCredentials">
</div>
</div>
<div class="form-group">
<label class="control-label">Required OAuth Credentials</label>
<div class="controls">
<input style="width:250px" type="text" ui-select2="userCredentialOptions" ng-model="realm.requiredOAuthClientCredentials">
</div>
</div>
</fieldset>
<div class="form-actions" data-ng-show="createRealm">
<button type="submit" data-ng-click="save()" class="primary" data-ng-show="changed">Save
</button>

View file

@ -1,5 +1,5 @@
<ul data-ng-hide="createRealm">
<li data-ng-class="(!path[2] || path[1] == 'role' || path[2] == 'roles') && 'active'"><a href="#/realms/{{realm.id}}">Realm Settings</a></li>
<li data-ng-class="(!path[2] || path[1] == 'role' || path[2] == 'roles' || path[2] == 'token-settings' || path[2] == 'required-credentials') && 'active'"><a href="#/realms/{{realm.id}}">Realm Settings</a></li>
<li data-ng-class="(path[2] == 'users' || path[1] == 'user') && 'active'"><a href="#/realms/{{realm.id}}/users">Users</a>
</li>
<li data-ng-class="(path[2] == 'applications' || path[1] == 'application') && 'active'"><a href="#/realms/{{realm.id}}/applications">Applications</a></li>

View file

@ -4,18 +4,19 @@
<div id="content-area" class="col-md-9" role="main">
<div class="top-nav" data-ng-hide="createRealm">
<ul class="rcue-tabs">
<li><a href="#">Settings</a></li>
<li><a href="#/realms/{{realm.id}}">Settings</a></li>
<li data-ng-show="realm.social"><a href="#">Social</a></li>
<li><a href="#">Roles</a></li>
<li><a href="#">Required Credentials</a></li>
<li class="active"><a href="#">Token Settings</a></li>
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
<li><a href="#/realms/{{realm.id}}/required-credentials">Required Credentials</a></li>
<li class="active"><a href="#/realms/{{realm.id}}/token-settings">Token Settings</a></li>
</ul>
</div>
<div id="content">
<h2 class="pull-left">Realm: <span>{{realm.realm}}</span></h2>
<p class="subtitle"></p>
<form name="realmForm" novalidate>
<fieldset>
<legend collapsed><span class="text">Token Settings</span></legend>
<legend uncollapsed><span class="text">Token Settings</span></legend>
<div class="form-group input-select">
<label for="tokenLifespan">Token lifespan</label>
<div class="input-group">

View file

@ -68,17 +68,17 @@ public class RealmManager {
public void updateRealm(RealmRepresentation rep, RealmModel realm) {
if (rep.getRealm() != null) realm.setName(rep.getRealm());
realm.setEnabled(rep.isEnabled());
realm.setSocial(rep.isSocial());
realm.setCookieLoginAllowed(rep.isCookieLoginAllowed());
realm.setRegistrationAllowed(rep.isRegistrationAllowed());
realm.setVerifyEmail(rep.isVerifyEmail());
realm.setResetPasswordAllowed(rep.isResetPasswordAllowed());
realm.setAutomaticRegistrationAfterSocialLogin(rep.isAutomaticRegistrationAfterSocialLogin());
realm.setSslNotRequired((rep.isSslNotRequired()));
realm.setAccessCodeLifespan(rep.getAccessCodeLifespan());
realm.setAccessCodeLifespanUserAction(rep.getAccessCodeLifespanUserAction());
realm.setTokenLifespan(rep.getTokenLifespan());
if (rep.isEnabled() != null) realm.setEnabled(rep.isEnabled());
if (rep.isSocial() != null) realm.setSocial(rep.isSocial());
if (rep.isCookieLoginAllowed() != null) realm.setCookieLoginAllowed(rep.isCookieLoginAllowed());
if (rep.isRegistrationAllowed() != null) realm.setRegistrationAllowed(rep.isRegistrationAllowed());
if (rep.isVerifyEmail() != null) realm.setVerifyEmail(rep.isVerifyEmail());
if (rep.isResetPasswordAllowed() != null) realm.setResetPasswordAllowed(rep.isResetPasswordAllowed());
if (rep.isAutomaticRegistrationAfterSocialLogin() != null) realm.setAutomaticRegistrationAfterSocialLogin(rep.isAutomaticRegistrationAfterSocialLogin());
if (rep.isSslNotRequired() != null) realm.setSslNotRequired((rep.isSslNotRequired()));
if (rep.getAccessCodeLifespan() != null) realm.setAccessCodeLifespan(rep.getAccessCodeLifespan());
if (rep.getAccessCodeLifespanUserAction() != null) realm.setAccessCodeLifespanUserAction(rep.getAccessCodeLifespanUserAction());
if (rep.getTokenLifespan() != null) realm.setTokenLifespan(rep.getTokenLifespan());
if (rep.getRequiredOAuthClientCredentials() != null) {
realm.updateRequiredOAuthClientCredentials(rep.getRequiredOAuthClientCredentials());
}
@ -104,17 +104,24 @@ public class RealmManager {
public void importRealm(RealmRepresentation rep, RealmModel newRealm) {
newRealm.setName(rep.getRealm());
newRealm.setEnabled(rep.isEnabled());
newRealm.setSocial(rep.isSocial());
newRealm.setTokenLifespan(rep.getTokenLifespan());
newRealm.setAccessCodeLifespan(rep.getAccessCodeLifespan());
newRealm.setAccessCodeLifespanUserAction(rep.getAccessCodeLifespanUserAction());
newRealm.setSslNotRequired(rep.isSslNotRequired());
newRealm.setCookieLoginAllowed(rep.isCookieLoginAllowed());
newRealm.setRegistrationAllowed(rep.isRegistrationAllowed());
newRealm.setVerifyEmail(rep.isVerifyEmail());
newRealm.setResetPasswordAllowed(rep.isResetPasswordAllowed());
newRealm.setAutomaticRegistrationAfterSocialLogin(rep.isAutomaticRegistrationAfterSocialLogin());
if (rep.isEnabled() != null) newRealm.setEnabled(rep.isEnabled());
if (rep.isSocial() != null) newRealm.setSocial(rep.isSocial());
if (rep.getTokenLifespan() != null) newRealm.setTokenLifespan(rep.getTokenLifespan());
else newRealm.setTokenLifespan(300);
if (rep.getAccessCodeLifespan() != null) newRealm.setAccessCodeLifespan(rep.getAccessCodeLifespan());
else newRealm.setAccessCodeLifespan(60);
if (rep.getAccessCodeLifespanUserAction() != null) newRealm.setAccessCodeLifespanUserAction(rep.getAccessCodeLifespanUserAction());
else newRealm.setAccessCodeLifespanUserAction(300);
if (rep.isSslNotRequired() != null) newRealm.setSslNotRequired(rep.isSslNotRequired());
if (rep.isCookieLoginAllowed() != null) newRealm.setCookieLoginAllowed(rep.isCookieLoginAllowed());
if (rep.isRegistrationAllowed() != null) newRealm.setRegistrationAllowed(rep.isRegistrationAllowed());
if (rep.isVerifyEmail() != null) newRealm.setVerifyEmail(rep.isVerifyEmail());
if (rep.isResetPasswordAllowed() != null) newRealm.setResetPasswordAllowed(rep.isResetPasswordAllowed());
if (rep.isAutomaticRegistrationAfterSocialLogin() != null) newRealm.setAutomaticRegistrationAfterSocialLogin(rep.isAutomaticRegistrationAfterSocialLogin());
if (rep.getPrivateKey() == null || rep.getPublicKey() == null) {
generateRealmKeys(newRealm);
} else {
@ -128,18 +135,24 @@ public class RealmManager {
for (String requiredCred : rep.getRequiredCredentials()) {
addRequiredCredential(newRealm, requiredCred);
}
} else {
addRequiredCredential(newRealm, CredentialRepresentation.PASSWORD);
}
if (rep.getRequiredApplicationCredentials() != null) {
for (String requiredCred : rep.getRequiredApplicationCredentials()) {
addResourceRequiredCredential(newRealm, requiredCred);
}
} else {
addResourceRequiredCredential(newRealm, CredentialRepresentation.PASSWORD);
}
if (rep.getRequiredOAuthClientCredentials() != null) {
for (String requiredCred : rep.getRequiredOAuthClientCredentials()) {
addOAuthClientRequiredCredential(newRealm, requiredCred);
}
} else {
addOAuthClientRequiredCredential(newRealm, CredentialRepresentation.PASSWORD);
}
if (rep.getUsers() != null) {

View file

@ -59,7 +59,7 @@ public class RealmAdminResource {
@PUT
@Consumes("application/json")
public void updateRealm(final RealmRepresentation rep) {
logger.info("updating realm: " + rep.getRealm());
logger.info("updating realm: " + realm.getName());
new RealmManager(session).updateRealm(rep, realm);
}

View file

@ -9,7 +9,6 @@ import org.keycloak.services.models.*;
import javax.ws.rs.*;
import javax.ws.rs.container.ResourceContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import java.util.ArrayList;
@ -150,11 +149,11 @@ public class UsersResource {
List<ApplicationModel> applications = realm.getApplications();
if (applications.size() > 0) {
Map<String, ApplicationRoleMappings> appMappings = new HashMap<String, ApplicationRoleMappings>();
Map<String, ApplicationRoleMappingsRepresentation> appMappings = new HashMap<String, ApplicationRoleMappingsRepresentation>();
for (ApplicationModel application : applications) {
List<RoleModel> roleMappings = application.getRoleMappings(user);
if (roleMappings.size() > 0) {
ApplicationRoleMappings mappings = new ApplicationRoleMappings();
ApplicationRoleMappingsRepresentation mappings = new ApplicationRoleMappingsRepresentation();
mappings.setUsername(user.getLoginName());
mappings.setApplicationId(application.getId());
mappings.setApplication(application.getName());
@ -257,7 +256,6 @@ public class UsersResource {
throw new NotFoundException();
}
ApplicationRoleMappings rep = new ApplicationRoleMappings();
List<RoleModel> mappings = application.getRoleMappings(user);
List<RoleRepresentation> mapRep = new ArrayList<RoleRepresentation>();
for (RoleModel roleModel : mappings) {