Comments (7)
感谢解答,问题已解决。应该是服务器环境问题,手动建了一台实例之后可以正常跑了。
from turms.
登录失败: (401, 1300) Unauthenticated
from turms.
想知道这个是有啥机制
In simple words, turms servers just compare the password passed from the HTTP request with the one on MongoDB, if they match, the request is authenticated. If not, unauthenticated.
Admin authentication code:
im.turms.server.common.access.admin.web.HttpRequestAuthenticator#authenticate
im.turms.server.common.domain.admin.service.BaseAdminService#authenticate
登录也需要鉴权么
In fact, there is no dedicated admin API for login
.
The login logic on the login dialog in turms-admin
just sends a head HTTP request to /admins
to check if the account and password match, so no something like JWT, or session ID will be generated.
过了一段时间之后登录就出现401错误了。重启服务之后又正常了,过了一段时间又报错了
I never encountered this problem, and the authentication code should be fine after code review.
And you can upgrade your servers to the latest images or code, and try again.
If you still encounter the problem, you can set some breakpoints in the methods mentioned above to check why your request are unauthenticated.
from turms.
断点了一下BaseAdminService#authenticate,正常登录的时候accountToAdmin是有管理员账号数据的,失败的时候这个accountToAdmin空了,看代码是去查了一下账号又添加到这个map里了,但是adminRepository.findById(account)返回的依旧是空,这个是啥意思,数据库被自动清空了?
public Mono queryAdmin(@NotNull String account) {
try {
Validator.notNull(account, "account");
} catch (ResponseException e) {
return Mono.error(e);
}
AdminInfo adminInfo = accountToAdmin.get(account);
if (adminInfo == null) {
return adminRepository.findById(account)
.doOnNext(admin -> accountToAdmin.put(account, new AdminInfo(admin, null)));
}
return Mono.just(adminInfo.getAdmin());
}
from turms.
If adminRepository.findById(account)
returns a Mono that emits nothing (e.g. Mono.empty()
), it means there is no such admin account matching the account
parameter as _id
in MongoDB. In other words, the admin doesn't exist.
Turms servers do NOT delete admin accounts automatically unless you set turms.service.fake.clear-all-collections-before-faking
to true
, then turms-service will drop all data in MongoDB when the server starts up every time.
The property is only set to true by default to reset mock data when you running the servers in the test
profile.
You can check if it is true by searching Start dropping databases
in your logs when the server is starting but has not started.
from turms.
clear-all-collections-before-faking这个设置确实为true,不过这个是每次重启才会奇效吧,我现在是服务启动之后放着不动,过个把小时就登录报错了。测试用的阿里云抢占式实例,这个有关系么
from turms.
You can run turms servers in the prod
or dev
profile so that your data won't be removed by servers automatically. The test
profile with the true clear-all-collections-before-faking
is used to run tests (e.g. integration tests, system tests) and will remove collections every time for testing.
测试用的阿里云抢占式实例,这个有关系么
Alicloud Spot/Preemptive instances will remove data whenever the instance stops, so it may related to the problem, and it depends on how you deploy turms servers and MongoDB.
from turms.
Related Issues (20)
- Add a UI component to display admin API endpoints
- Support seaching logs
- Support display/search logs
- Respond with the status of all dependent services (e.g., MongoDB, Redis) in the health-check endpoint
- Allow admin users to have multiple roles HOT 1
- Checklist before updating to 0.11.0 HOT 1
- When it starts, nothing is output and it stops all of a sudden ? HOT 1
- 你好,请问能否提供一个Objective-C的SDK? HOT 1
- CREATE_GROUP_JOIN_REQUEST_REQUEST 疑问 HOT 3
- Add equivalent SQL examples for admin API requests HOT 1
- 添加好友成功的通知 HOT 2
- Provide more built-in admin roles
- Remove `turms-plugin-rasa` once we introduce a plugin for RAG HOT 1
- turms gateway cluster HOT 2
- 求助:拉取镜像启动的时候提示7510端口被占用 HOT 1
- 求助:拉取Turms服务端Docker镜像,并运行后。admin无法登录。
- 求助,mongodb 做配置中心这一块,debug也没有看到 拉取 配置 例如redis的配置。
- Request for Help: Error 503 ... After pulling Docker and running it normally, the URL http://xxxx:6510/cluster/dashboard cannot be accessed(error screenshot inside). I appreciate your help with resolving this issue. HOT 1
- Support encrypting/decrypting local files
- Provide a consistent and convenient `TlsOptions` param to `ConnectionService#connect`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turms.