stringObjectEntry : objectMap.entrySet()) {
+ if (stringObjectEntry.getValue() instanceof Map) {
+ Map mapVal = ((Map) stringObjectEntry.getValue());
+ boolean maybeIsList = mapVal.keySet().stream().allMatch(org.hswebframework.utils.StringUtils::isInt);
+ if (maybeIsList) {
+ stringObjectEntry.setValue(mapVal.values());
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public Authentication authenticate(AuthenticationRequest request) {
+ if (request instanceof PlainTextUsernamePasswordAuthenticationRequest) {
+ return sync(users.values().stream()
+ .filter(user ->
+ ((PlainTextUsernamePasswordAuthenticationRequest) request).getUsername().equals(user.getUsername())
+ && ((PlainTextUsernamePasswordAuthenticationRequest) request).getPassword().equals(user.getPassword()))
+ .findFirst()
+ .map(properties -> properties.toAuthentication(dataAccessConfigBuilderFactory))
+ .orElseThrow(() -> new ValidationException("用户不存在")));
+ }
+
+ throw new UnsupportedOperationException("不支持的授权类型:" + request);
+
+ }
+
+ @Override
+ public Authentication getByUserId(String userId) {
+ return authentications.get(userId);
+ }
+
+ @Override
+ public Authentication sync(Authentication authentication) {
+ authentications.put(authentication.getUser().getId(), authentication);
+ return authentication;
+ }
+
+ void addAuthentication(Authentication authentication) {
+ sync(authentication);
+ }
+}
diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationProperties.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationProperties.java
new file mode 100644
index 000000000..28bc188b8
--- /dev/null
+++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/embed/EmbedAuthenticationProperties.java
@@ -0,0 +1,97 @@
+package org.hswebframework.web.authorization.basic.embed;
+
+import com.alibaba.fastjson.JSON;
+import lombok.Getter;
+import lombok.Setter;
+import org.hswebframework.web.authorization.Authentication;
+import org.hswebframework.web.authorization.Permission;
+import org.hswebframework.web.authorization.Role;
+import org.hswebframework.web.authorization.builder.DataAccessConfigBuilderFactory;
+import org.hswebframework.web.authorization.simple.SimpleAuthentication;
+import org.hswebframework.web.authorization.simple.SimplePermission;
+import org.hswebframework.web.authorization.simple.SimpleRole;
+import org.hswebframework.web.authorization.simple.SimpleUser;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ *
+ * hsweb:
+ * users:
+ * admin:
+ * name: 超级管理员
+ * username: admin
+ * password: admin
+ * roles:
+ * - id: admin
+ * name: 管理员
+ * - id: user
+ * name: 用户
+ * permissions:
+ * - id: user-manager
+ * actions: *
+ * dataAccesses:
+ * - action: query
+ * type: DENY_FIELDS
+ * fields: password,salt
+ *
+ *
+ * @author zhouhao
+ * @since 3.0.0-RC
+ */
+@Getter
+@Setter
+public class EmbedAuthenticationProperties {
+
+ private String id;
+
+ private String name;
+
+ private String username;
+
+ private String type;
+
+ private String password;
+
+ private List roles = new ArrayList<>();
+
+ private List permissions = new ArrayList<>();
+
+ @Getter
+ @Setter
+ public static class PermissionInfo {
+ private String id;
+
+ private Set actions = new HashSet<>();
+
+ private List