租赁账户PROXY\_ACCOUNT中的rentApp租赁应用页面需要有引导用户创建应用功能,和应用详情,应用详情中需要能够创建对应的应用凭证,要求页面美观,用户交互友好。
This commit is contained in:
1 parent
b3419aa389
commit
101140f3c2
4 files changed
+77
-2
No files matched your search
@@ -40,6 +40,36 @@ public class RentalBusinessTest {
|
||||
private static final String OWNER = "TR7NHqjeKQxGTCi8q8ZY4pL8otgjLj6t";
|
||||
private final ObjectMapper json = new ObjectMapper();
|
||||
|
||||
/** 真实查询验证应用隔离、节点凭证隔离与 Secret 不外泄。 */
|
||||
@Test
|
||||
public void appDetailIsOwnedAndNeverReturnsSecrets() {
|
||||
com.ruoyi.common.core.domain.entity.SysUser user =
|
||||
new com.ruoyi.common.core.domain.entity.SysUser();
|
||||
user.setUserId(10L);
|
||||
com.ruoyi.common.core.domain.model.LoginUser login =
|
||||
new com.ruoyi.common.core.domain.model.LoginUser(user, Collections.emptySet());
|
||||
org.springframework.security.core.context.SecurityContextHolder.getContext().setAuthentication(
|
||||
new org.springframework.security.authentication.UsernamePasswordAuthenticationToken(
|
||||
login, null, Collections.emptyList()));
|
||||
try {
|
||||
tx.execute(status -> identity.issue("APP", app, 10));
|
||||
tx.execute(status -> identity.issue("NODE", node, 20));
|
||||
RentalController controller = new RentalController(
|
||||
store, null, identity, orders, funds, reviews, tasks, null, null);
|
||||
Map<String, Object> result = (Map<String, Object>) controller.appDetail(app).get("data");
|
||||
List<Map<String, Object>> credentials =
|
||||
(List<Map<String, Object>>) result.get("credentials");
|
||||
assertEquals(1, credentials.size());
|
||||
assertTrue(credentials.get(0).containsKey("api_key"));
|
||||
assertFalse(credentials.get(0).containsKey("api_secret"));
|
||||
long foreign = store.insert("app", map("user_id", 20, "name", "foreign", "status", "ACTIVE"));
|
||||
expectFailure(() -> controller.appDetail(foreign));
|
||||
expectFailure(() -> controller.appDetail(Long.MAX_VALUE));
|
||||
} finally {
|
||||
org.springframework.security.core.context.SecurityContextHolder.clearContext();
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
JdbcDataSource source = new JdbcDataSource();
|
||||
|
||||
Reference in new issue
Block a user