mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-03 03:38:33 +08:00
PL-10619 REST should have an ability to work without security token for entities with constraints (rename application property)
This commit is contained in:
parent
fccfda8f17
commit
7bafde32fd
@ -673,7 +673,7 @@ public class EntityImportExport implements EntityImportExportAPI {
|
||||
}
|
||||
|
||||
protected boolean useSecurityToken() {
|
||||
return globalConfig.getRestUseSecurityTokenForClient();
|
||||
return globalConfig.getRestRequiresSecurityToken();
|
||||
}
|
||||
|
||||
protected Entity findReferenceEntity(Entity entity, EntityImportViewProperty viewProperty, CommitContext commitContext,
|
||||
|
@ -231,7 +231,7 @@ public class EntitySerialization implements EntitySerializationAPI {
|
||||
writeFields(entity, jsonObject, view, cyclicReferences);
|
||||
}
|
||||
|
||||
if (globalConfig.getRestUseSecurityTokenForClient()) {
|
||||
if (globalConfig.getRestRequiresSecurityToken()) {
|
||||
if (entity instanceof BaseGenericIdEntity || entity instanceof EmbeddableEntity) {
|
||||
SecurityState securityState = getSecurityState(entity);
|
||||
if (securityState != null) {
|
||||
@ -461,7 +461,7 @@ public class EntitySerialization implements EntitySerializationAPI {
|
||||
}
|
||||
}
|
||||
|
||||
if (globalConfig.getRestUseSecurityTokenForClient() && entity instanceof BaseGenericIdEntity) {
|
||||
if (globalConfig.getRestRequiresSecurityToken() && entity instanceof BaseGenericIdEntity) {
|
||||
JsonPrimitive securityTokenJonPrimitive = jsonObject.getAsJsonPrimitive("__securityToken");
|
||||
if (securityTokenJonPrimitive != null) {
|
||||
byte[] securityToken = Base64.getDecoder().decode(securityTokenJonPrimitive.getAsString());
|
||||
@ -572,7 +572,7 @@ public class EntitySerialization implements EntitySerializationAPI {
|
||||
Entity entity = metadata.create(metaClass);
|
||||
clearFields(entity);
|
||||
readFields(jsonObject, entity);
|
||||
if (globalConfig.getRestUseSecurityTokenForClient() && entity instanceof EmbeddableEntity) {
|
||||
if (globalConfig.getRestRequiresSecurityToken() && entity instanceof EmbeddableEntity) {
|
||||
JsonPrimitive securityTokenJonPrimitive = jsonObject.getAsJsonPrimitive("__securityToken");
|
||||
if (securityTokenJonPrimitive != null) {
|
||||
byte[] securityToken = Base64.getDecoder().decode(securityTokenJonPrimitive.getAsString());
|
||||
|
@ -238,8 +238,8 @@ public interface GlobalConfig extends Config {
|
||||
/**
|
||||
* @return true if REST doesn't check security token for entities with security constraints
|
||||
*/
|
||||
@Property("cuba.rest.useSecurityTokenForClient")
|
||||
@Property("cuba.rest.requiresSecurityToken")
|
||||
@Source(type = SourceType.DATABASE)
|
||||
@DefaultBoolean(false)
|
||||
boolean getRestUseSecurityTokenForClient();
|
||||
boolean getRestRequiresSecurityToken();
|
||||
}
|
Loading…
Reference in New Issue
Block a user