-
Notifications
You must be signed in to change notification settings - Fork 289
feat(dashboard): Dashboard support token-based login #3040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Meggielqk
wants to merge
5
commits into
release-5.6
Choose a base branch
from
r56-dashboard-login-with-token
base: release-5.6
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
26b9692
feat(dashboard): Dashboard support token-based login
Meggielqk 5572601
Update according to comments
Meggielqk 8762b22
Update en_US/dashboard/introduction.md
Meggielqk 1310d97
Combine the steps
Meggielqk e67cd34
Update zh_CN/dashboard/introduction.md
Meggielqk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ Support for custom plug-in integration, Extend EMQX connectivity protocols throu | |
|
||
In addition to debugging through online MQTT over WebSocket client connections and publishing subscriptions, we also support diagnosing and finding issues using things like slow subscriptions and online logs tracing and alarms. | ||
|
||
## Running | ||
## Launch Dashboard | ||
|
||
EMQX Dashboard is a web application that listens to port `18083` by default. After installing EMQX successfully, you can access and use EMQX Dashboard by opening <http://localhost:18083/> (replace localhost with the actual IP address if deployed on a non-local machine) through your browser. | ||
|
||
|
@@ -46,6 +46,54 @@ For users who have installed EMQX for the first time, you can use the default us | |
|
||
After logging in for the first time, the system will automatically detect that you are logging in with the default username and password, and will force you to change the default password, which is good for the security of accessing Dashboard, note that the changed password cannot be the same as the original password, and it is not recommended to use `public` as the login password again. | ||
|
||
### Token-Based Login via URL | ||
|
||
Starting from EMQX 5.6.0, the Dashboard supports a token-based login method that allows users to log in directly by embedding authentication information in the URL. | ||
|
||
This feature is particularly useful for seamless redirection and integration scenarios where a user should be logged in automatically without entering credentials manually. | ||
|
||
#### How To Use This Login Method | ||
|
||
1. Call the `/login` API to obtain the login token and related information. | ||
|
||
2. Manually add the username used during login (not included in the `/login` response). | ||
|
||
3. Combine the data into a JSON structure: | ||
|
||
```json | ||
{ | ||
"license": { | ||
"edition": "ee" | ||
}, | ||
"role": "administrator", | ||
"token": "xxx.jwt.token", | ||
"version": "5.5.0-g0fef19f8", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this update is for version 5.6, may be we should set version 5.6.1 here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, but why not 5.6.0? |
||
"username": "admin" | ||
} | ||
``` | ||
|
||
4. Convert the JSON string to Base64. | ||
|
||
5. Embed the encoded string in the `login_meta` query parameter of the Dashboard URL. | ||
|
||
Meggielqk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#### Example URL | ||
|
||
For versions **before 5.6.0**: | ||
|
||
```bash | ||
http://localhost:18083?login_meta=BASE64_ENCODED_STRING | ||
``` | ||
|
||
Redirects to the default cluster overview page. | ||
|
||
For **version 5.6.0 and later**, you can also specify a target page: | ||
|
||
```bash | ||
http://localhost:18083/#/dashboard/overview?login_meta=BASE64_ENCODED_STRING | ||
``` | ||
|
||
This method provides a smooth, pre-authenticated user experience for accessing the EMQX Dashboard. Make sure to handle the token securely and ensure it has appropriate expiration and scope limits. | ||
|
||
## Reset password | ||
|
||
You can reset your Dashboard login password via the `admins` command. For details, see [CLI - admins](../admin/cli.md#admins). | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.