realm progress

This commit is contained in:
Bill Burke 2013-08-10 16:01:00 -04:00
parent a81d03213d
commit 5b03b56c4a
8 changed files with 72 additions and 5 deletions

View file

@ -18,6 +18,7 @@ public class RealmRepresentation {
protected boolean sslNotRequired;
protected boolean cookieLoginAllowed;
protected boolean registrationAllowed;
protected boolean social;
protected String privateKey;
protected String publicKey;
protected List<RoleRepresentation> roles;
@ -205,4 +206,12 @@ public class RealmRepresentation {
public void setRegistrationAllowed(boolean registrationAllowed) {
this.registrationAllowed = registrationAllowed;
}
public boolean isSocial() {
return social;
}
public void setSocial(boolean social) {
this.social = social;
}
}

View file

@ -58,6 +58,8 @@ module.controller('RealmDropdownCtrl', function($scope, Realm, Current, Auth, $l
module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $http, $location, Dialog, Notifications) {
$scope.createRealm = !realm.id;
console.log('RealmDetailCtrl');
if ($scope.createRealm) {
$scope.realm = {
enabled: true,
@ -67,7 +69,9 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
tokenLifespanUnit: 'SECONDS',
accessCodeLifespan: 300,
accessCodeLifespanUnit: 'SECONDS',
requiredCredentials: ['password']
requiredCredentials: ['password'],
requiredOAuthClientCredentials: ['password'],
requiredApplicationCredentials: ['password']
};
} else {
@ -81,6 +85,7 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
}
if (Current.realm == null || Current.realm.id != realm.id) {
console.log('should be unreachable');
console.log('Why? ' + Current.realms.length + ' ' + Current.realm);
return;
}
$scope.realm = angular.copy(realm);
@ -133,6 +138,7 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
});
} else {
console.log('updating realm...');
$scope.changed = false;
Realm.update(realmCopy, function() {
var id = realmCopy.id;
var data = Realm.query(function() {
@ -140,6 +146,7 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht
for (var i = 0; i < Current.realms.length; i++) {
if (Current.realms[i].id == id) {
Current.realm = Current.realms[i];
oldCopy = angular.copy($scope.realm);
}
}
});

View file

@ -19,7 +19,7 @@
<fieldset>
<div class="control-group">
<label for="realmForm-name" class="control-label">Name</label>
<label for="realmForm-name" class="control-label">Name <span class="required">*</span></label>
<div class="controls">
<input class="input-xlarge" type="text" name="name" data-ng-model="realm.realm" autofocus
@ -118,12 +118,26 @@
</div>
</div>
<div class="control-group">
<label class="control-label">User Required Credentials</label>
<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="control-group">
<label class="control-label">Required Application Credentials</label>
<div class="controls">
<input style="width:250px" type="text" ui-select2="userCredentialOptions" ng-model="realm.requiredApplicationCredentials">
</div>
</div>
<div class="control-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="btn btn-primary" data-ng-show="changed">Save

View file

@ -69,6 +69,7 @@ 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.setSslNotRequired((rep.isSslNotRequired()));
@ -78,7 +79,6 @@ public class RealmManager {
realm.updateRequiredOAuthClientCredentials(rep.getRequiredOAuthClientCredentials());
}
if (rep.getRequiredCredentials() != null) {
logger.info("updating required credentials");
realm.updateRequiredCredentials(rep.getRequiredCredentials());
}
if (rep.getRequiredApplicationCredentials() != null) {
@ -98,6 +98,7 @@ 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.setSslNotRequired(rep.isSslNotRequired());
@ -233,6 +234,7 @@ public class RealmManager {
rep.setId(realm.getId());
rep.setRealm(realm.getName());
rep.setEnabled(realm.isEnabled());
rep.setSocial(realm.isSocial());
rep.setSslNotRequired(realm.isSslNotRequired());
rep.setCookieLoginAllowed(realm.isCookieLoginAllowed());
rep.setPublicKey(realm.getPublicKeyPem());

View file

@ -120,4 +120,8 @@ public interface RealmModel {
void updateRequiredOAuthClientCredentials(Set<String> creds);
void updateRequiredApplicationCredentials(Set<String> creds);
boolean isSocial();
void setSocial(boolean social);
}

View file

@ -26,6 +26,7 @@ import org.picketlink.idm.credential.TOTPCredentials;
import org.picketlink.idm.credential.UsernamePasswordCredentials;
import org.picketlink.idm.credential.X509CertificateCredentials;
import org.picketlink.idm.model.IdentityType;
import org.picketlink.idm.model.annotation.AttributeProperty;
import org.picketlink.idm.model.sample.Grant;
import org.picketlink.idm.model.sample.Role;
import org.picketlink.idm.model.sample.SampleModel;
@ -110,6 +111,16 @@ public class RealmAdapter implements RealmModel {
updateRealm();
}
@Override
public boolean isSocial() {
return realm.isSocial();
}
@Override
public void setSocial(boolean social) {
realm.setSocial(social);
}
@Override
public boolean isSslNotRequired() {
return realm.isSslNotRequired();

View file

@ -14,6 +14,7 @@ public class RealmData extends AbstractPartition {
private boolean sslNotRequired;
private boolean cookieLoginAllowed;
private boolean registrationAllowed;
private boolean social;
private int tokenLifespan;
private int accessCodeLifespan;
private String publicKeyPem;
@ -44,6 +45,15 @@ public class RealmData extends AbstractPartition {
this.enabled = enabled;
}
@AttributeProperty
public boolean isSocial() {
return social;
}
public void setSocial(boolean social) {
this.social = social;
}
@AttributeProperty
public boolean isSslNotRequired() {
return sslNotRequired;

View file

@ -35,6 +35,8 @@ public class RealmEntity implements Serializable {
@AttributeValue
private boolean registrationAllowed;
@AttributeValue
private boolean social;
@AttributeValue
private int tokenLifespan;
@AttributeValue
private int accessCodeLifespan;
@ -94,6 +96,14 @@ public class RealmEntity implements Serializable {
this.registrationAllowed = registrationAllowed;
}
public boolean isSocial() {
return social;
}
public void setSocial(boolean social) {
this.social = social;
}
public int getTokenLifespan() {
return tokenLifespan;
}