KEYCLOAK-1070 JSON representation and export/import for userConsent
This commit is contained in:
1 parent
11035dbe1b
commit
34e033e351
21 files changed
+204
-70
No files matched your search
+2
-1
@@ -305,7 +305,8 @@ public class ClientAdapter extends AbstractMongoAdapter<MongoClientEntity> imple
|
||||
throw new RuntimeException("protocol mapper name must be unique per protocol");
|
||||
}
|
||||
ProtocolMapperEntity entity = new ProtocolMapperEntity();
|
||||
entity.setId(KeycloakModelUtils.generateId());
|
||||
String id = model.getId() != null ? model.getId() : KeycloakModelUtils.generateId();
|
||||
entity.setId(id);
|
||||
entity.setProtocol(model.getProtocol());
|
||||
entity.setName(model.getName());
|
||||
entity.setProtocolMapper(model.getProtocolMapper());
|
||||
|
||||
+5
-5
@@ -417,7 +417,7 @@ public class UserAdapter extends AbstractMongoAdapter<MongoUserEntity> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGrantedConsent(UserConsentModel consent) {
|
||||
public void addConsent(UserConsentModel consent) {
|
||||
String clientId = consent.getClient().getId();
|
||||
if (getConsentEntityByClientId(clientId) != null) {
|
||||
throw new ModelDuplicateException("Consent already exists for client [" + clientId + "] and user [" + user.getId() + "]");
|
||||
@@ -431,13 +431,13 @@ public class UserAdapter extends AbstractMongoAdapter<MongoUserEntity> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserConsentModel getGrantedConsentByClient(String clientId) {
|
||||
public UserConsentModel getConsentByClient(String clientId) {
|
||||
UserConsentEntity consentEntity = getConsentEntityByClientId(clientId);
|
||||
return consentEntity!=null ? toConsentModel(consentEntity) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserConsentModel> getGrantedConsents() {
|
||||
public List<UserConsentModel> getConsents() {
|
||||
List<UserConsentModel> result = new ArrayList<UserConsentModel>();
|
||||
|
||||
DBObject query = new QueryBuilder()
|
||||
@@ -488,7 +488,7 @@ public class UserAdapter extends AbstractMongoAdapter<MongoUserEntity> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGrantedConsent(UserConsentModel consent) {
|
||||
public void updateConsent(UserConsentModel consent) {
|
||||
String clientId = consent.getClient().getId();
|
||||
MongoUserConsentEntity consentEntity = getConsentEntityByClientId(clientId);
|
||||
if (consentEntity == null) {
|
||||
@@ -500,7 +500,7 @@ public class UserAdapter extends AbstractMongoAdapter<MongoUserEntity> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean revokeGrantedConsentForClient(String clientId) {
|
||||
public boolean revokeConsentForClient(String clientId) {
|
||||
MongoUserConsentEntity entity = getConsentEntityByClientId(clientId);
|
||||
if (entity == null) {
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user