Feat/add test scripts (#1341)

* kubernetes for kustomize learning

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* feat(main): add openim server test cicd

* feat(main): add openim scripts token

---------

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
pull/1343/head
Xinwei Xiong 2 years ago committed by GitHub
parent a9e590109c
commit a0621aead4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,38 +24,49 @@ on:
types: [created] types: [created]
jobs: jobs:
create-pr: sync-issue-to-pr:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.pull_request.base.ref == 'main'
# && github.event.pull_request.merged == true
steps: steps:
- name: Check out code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Create PR to release branch - name: Sync Issue to PR
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
run: | run: |
ISSUEID=$(gh pr view ${{ github.event.pull_request.number }} --repo $OWNER/$REPO | grep -oP 'Fixes #\K\d+') PR_BODY="${{ github.event.pull_request.body }}"
echo "===========> $ISSUEID"
ISSUE=$(gh issue view $ISSUEID --repo $OWNER/$REPO --json labels,assignees,milestone,title) ISSUE_NUMBER=$(echo "$PR_BODY" | grep -oP 'Fixes #\K\d+')
echo "===========> $ISSUE" if [[ -z "$ISSUE_NUMBER" ]]; then
echo "No Issue number found."
LABELS=$(echo $ISSUE | jq -r '.labels[] | select(.name) | .name' | jq -R -r -s -c 'split("\n")[:-1] | join(",")') exit 1
ASSIGNEES=$(echo $ISSUE | jq -r '.assignees[] | select(.login) | .login' | jq -R -s -c 'split("\n")[:-1] | join(",")') fi
MILESTONE=$(echo $ISSUE | jq -r '.milestone | select(.title) | .title')
TITLE=$(echo $ISSUE | jq -r '.title') echo "Issue number found: $ISSUE_NUMBER"
gh pr edit ${{ github.event.pull_request.number }} --repo $OWNER/$REPO --add-label "$LABELS" --add-assignee "$ASSIGNEES" --milestone "$MILESTONE" # Using GitHub CLI to get issue details
gh issue view "$ISSUE_NUMBER" --repo "${{ github.repository }}" --json labels,assignees,milestone,title > issue_data.json
# git checkout -b bot/merge-to-release-$ISSUEID
# git push origin bot/merge-to-release-$ISSUEID # Check if jq is installed
# gh pr create --base release --head bot/merge-to-release-$ISSUEID --title "Merge main to release" --body "" if ! command -v jq &> /dev/null; then
# gh pr create --base main --head feat/auto-release-pr-624 --title "The bug is fixed" --body "$x" --repo openimsdk/open-im-server --reviewer "cubxxw" echo "Installing jq..."
sudo apt-get install -y jq
fi
# Parse data with jq
LABELS=$(jq -r '.labels | map(.name) | join(",")' issue_data.json)
ASSIGNEES=$(jq -r '.assignees | map(.login) | join(",")' issue_data.json)
MILESTONE=$(jq -r '.milestone.title' issue_data.json)
# Check if any of the fields are empty and set them to None
LABELS=${LABELS:-None}
ASSIGNEES=${ASSIGNEES:-None}
MILESTONE=${MILESTONE:-None}
# Edit the PR with issue details, handling empty fields
gh pr edit "${{ github.event.pull_request.number }}" --repo "${{ github.repository }}" \
${LABELS:+--add-label "$LABELS"} \
${ASSIGNEES:+--add-assignee "$ASSIGNEES"} \
${MILESTONE:+--milestone "$MILESTONE"}
continue-on-error: true continue-on-error: true
env: env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
ISSUE: ${{ github.event.issue.html_url }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}

@ -39,7 +39,7 @@ jobs:
In addition to Slack, we also offer the following ways to get in touch: In addition to Slack, we also offer the following ways to get in touch:
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" target="_blank"><img src="https://img.shields.io/badge/Slack-OpenIM%2B-blueviolet?logo=slack&amp;logoColor=white"></a> We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel. + <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" target="_blank"><img src="https://img.shields.io/badge/Slack-OpenIM%2B-blueviolet?logo=slack&amp;logoColor=white"></a> We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel.
+ <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a> Get in touch with us on [Gmail](https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email. + <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=info@openim.io" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a> Get in touch with us on [Gmail](https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email.
+ <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a> Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information. + <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a> Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information.
+ <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a> Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible. + <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a> Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible.

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
name: Create Tag name: OpenIM Create Tag
on: on:
issue_comment: issue_comment:

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
name: 'Github Rebot for Cherry Pick when PR is merged' name: Github Rebot for Cherry Pick when PR is merged
on: on:
pull_request_target: pull_request_target:
types: types:

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
name: Check-Coverage name: OpenIM Check Coverage
on: on:
workflow_dispatch: workflow_dispatch:

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
name: "OpenIM CLA Assistant" name: OpenIM CLA Assistant
on: on:
issue_comment: issue_comment:
types: [created] types: [created]
@ -33,7 +33,7 @@ env:
OPEN_IM_SERVER_CLA_DOCUMENT: https://github.com/openim-sigs/cla/blob/main/README.md OPEN_IM_SERVER_CLA_DOCUMENT: https://github.com/openim-sigs/cla/blob/main/README.md
OPEN_IM_SERVER_SIGNATURES_PATH: signatures/${{ github.event.repository.name }}/cla.json OPEN_IM_SERVER_SIGNATURES_PATH: signatures/${{ github.event.repository.name }}/cla.json
OPEN_IM_SERVER_ALLOWLIST: kubbot,bot* OPEN_IM_SERVER_ALLOWLIST: kubbot,bot*,bot-*,bot/*,bot-/*,bot,*[bot]
jobs: jobs:
CLAAssistant: CLAAssistant:

@ -1,17 +1,3 @@
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Create Branch on Tag name: Create Branch on Tag
on: on:
@ -19,6 +5,10 @@ on:
tags: tags:
- 'v*.*.0' - 'v*.*.0'
permissions:
contents: write
actions: write
jobs: jobs:
create-branch: create-branch:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -36,41 +26,38 @@ jobs:
- name: Install git-chglog - name: Install git-chglog
run: make install.git-chglog run: make install.git-chglog
- name: Create Branch - name: Create Branch and Push
env:
TAG_NAME: ${{ github.ref_name }}
run: | run: |
TAG_NAME=${GITHUB_REF/refs\/tags\//}
IFS='.' read -ra VERSION_PARTS <<< "$TAG_NAME" IFS='.' read -ra VERSION_PARTS <<< "$TAG_NAME"
if [[ "${VERSION_PARTS[2]}" = "0" ]]; then if [[ "${VERSION_PARTS[2]}" = "0" ]]; then
BRANCH_NAME="release-v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}" BRANCH_NAME="release-v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}"
echo "Creating branch $BRANCH_NAME" echo "Creating branch $BRANCH_NAME"
git checkout -b "$BRANCH_NAME" git checkout -b "$BRANCH_NAME"
git push origin "$BRANCH_NAME" git push origin "$BRANCH_NAME"
else
echo "Not a release tag. Skipping branch creation."
fi fi
continue-on-error: true
- name: Push Changes - name: Create and Commit CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v5 if: endsWith(github.ref_name, '.0')
with:
commit_message: "Auto Commit CHANGELOG"
branch: release-v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
- name: Create and Push CHANGELOG
run: | run: |
git checkout main git fetch --all
TAG_NAME=${GITHUB_REF/refs\/tags\//} TAG_NAME=${GITHUB_REF#refs/tags/}
IFS='.' read -ra VERSION_PARTS <<< "$TAG_NAME" IFS='.' read -ra VERSION_PARTS <<< "$TAG_NAME"
if [[ "${VERSION_PARTS[2]}" = "0" ]]; then git checkout main
cd CHANGELOG cd CHANGELOG
git-chglog --tag-filter-pattern "v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.*" -o "CHANGELOG-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.md" git-chglog --tag-filter-pattern "v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.*" -o "CHANGELOG-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.md"
git add "CHANGELOG-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.md" git add "CHANGELOG-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.md"
git commit -m "Update CHANGELOG for $TAG_NAME" git commit -m "Update CHANGELOG for $TAG_NAME" || echo "No changes to commit."
fi continue-on-error: true
- name: Push Changes - name: Push CHANGELOG to Main
uses: stefanzweifel/git-auto-commit-action@v5 if: steps.create-and-commit-changelog.outputs.changes == 'true'
uses: ad-m/github-push-action@v0.6.0
with: with:
commit_message: "Auto Commit CHANGELOG" github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
branch: main branch: main
env: continue-on-error: true
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}

@ -1,55 +0,0 @@
# Copyright © 2023 OpenIM open source community. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: OpenIM Deploy for dev
on:
push:
branches:
- 'devops' # Only for the dev branch
- 'main'
paths:
- '.github/workflows/*'
# - '__test__/**' # dev No immediate testing is required
- 'src/**'
- 'Dockerfile'
- 'docker-compose.yml'
- 'bin/*'
jobs:
deploy-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v1.0.0
env:
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
with:
host: "${{ secrets.SG_M1_HOST }}, ${{ secrets.SG_N1_HOST }}, ${{ secrets.SG_N2_HOST}}"
username: ${{ secrets.SG_USERNAME }}
password: ${{ secrets.SG_PASSWORD }}
port: ${{ secrets.SG_PORT }}
envs: OWNER,REPO
script_stop: true
script: |
mkdir -p /test/openim
cd /test/openim
pwd;ls -al
echo "OWNER: $OWNER"
echo "REPO: $REPO"
git clone -b develop https://github.com/${OWNER}/${REPO}.git; cd ${REPO}
docker compose up -d
continue-on-error: true

@ -2,7 +2,7 @@
# Licensed under the MIT License (the "License"); # Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
name: Dependency Review name: OpenIM Dependency Review
on: [pull_request] on: [pull_request]
permissions: permissions:

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
name: e2e name: OpenIM E2E Test
on: on:
workflow_dispatch: workflow_dispatch:

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
name: first-interaction name: OpenIM First Interaction
on: on:
issues: issues:

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
name: 'issue translator' name: OpenIM Issue Aotu Translator
on: on:
issue_comment: issue_comment:
types: [created] types: [created]

@ -12,12 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
name: 'OpenIM Commit Action' name: OpenIM OpenCommit Action
on: on:
push: push:
branches: # this list of branches is often enough,
- main # but you may still ignore other public branches
branches-ignore: [main master dev development release]
jobs: jobs:
opencommit: opencommit:
@ -27,20 +28,20 @@ jobs:
permissions: write-all permissions: write-all
steps: steps:
- name: Setup Node.js Environment - name: Setup Node.js Environment
uses: actions/setup-node@v4 uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '16'
- uses: actions/checkout@v4 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: di-sukharev/opencommit@github-action-v1.0.4 - uses: di-sukharev/opencommit@github-action-v1.0.4
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
env: env:
# set openAI api key in repo actions secrets, # set openAI api key in repo actions secrets,
# for openAI keys go to: https://platform.openai.com/account/api-keys # for openAI keys go to: https://platform.openai.com/account/api-keys
# for repo secret go to: https://github.com/kuebcub/settings/secrets/actions # for repo secret go to: <your_repo_url>/settings/secrets/actions
OCO_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} OCO_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# customization # customization
@ -48,5 +49,6 @@ jobs:
OCO_OPENAI_BASE_PATH: '' OCO_OPENAI_BASE_PATH: ''
OCO_DESCRIPTION: false OCO_DESCRIPTION: false
OCO_EMOJI: false OCO_EMOJI: false
OCO_MODEL: gpt-3.5-turbo OCO_MODEL: gpt-3.5-turbo-16k
OCO_LANGUAGE: en OCO_LANGUAGE: en
OCO_PROMPT_MODULE: conventional-commit

@ -41,7 +41,9 @@ jobs:
run: | run: |
git config user.name 'openimbot' git config user.name 'openimbot'
git config user.email 'openimsdk@qq.com' git config user.email 'openimsdk@qq.com'
git checkout -b cicd/patch-${{ github.event.number }} BRANCH_NAME="auto-pr-$(date +'%Y%m%d%H%M%S')"
git checkout -b $BRANCH_NAME
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
@ -50,6 +52,7 @@ jobs:
sudo make tidy sudo make tidy
sudo make tools.verify.go-gitlint sudo make tools.verify.go-gitlint
echo "Run go modules tidy successfully" echo "Run go modules tidy successfully"
continue-on-error: true
- name: Run go format - name: Run go format
run: | run: |
@ -75,13 +78,8 @@ jobs:
echo "Run unit test and get test coverage successfully" echo "Run unit test and get test coverage successfully"
continue-on-error: true continue-on-error: true
# - name: Initialize CodeQL - name: Perform CodeQL Analysis
# uses: github/codeql-action/init@v2 uses: github/codeql-action/analyze@v2
# with:
# languages: go
# - name: Perform CodeQL Analysis
# uses: github/codeql-action/analyze@v2
- name: OpenIM verify copyright - name: OpenIM verify copyright
run: | run: |
@ -90,30 +88,25 @@ jobs:
echo "OpenIM verify successfully" echo "OpenIM verify successfully"
continue-on-error: true continue-on-error: true
# - name: Commit code
# run: |
# git add .
# git commit -m "cicd: bump League Patch to cicd/patch-${{ github.event.number }}"
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@v5 uses: peter-evans/create-pull-request@v5
with: with:
token: ${{ secrets.BOT_GITHUB_TOKEN }} token: ${{ secrets.BOT_GITHUB_TOKEN }}
commit-message: "cicd: bump League Patch to cicd/patch-${{ github.event.number }}" commit-message: "cicd: bump League Patch"
title: Bump League Patch to cicd/patch-${{ github.event.number }}
author: kubbot <kubbot@3293172751ysy@gmail.com> author: kubbot <kubbot@3293172751ysy@gmail.com>
signoff: false signoff: false
draft: false draft: false
branch: "cicd/patch-${{ github.event.number }}" branch: ''
assignees: cubxxw assignees: cubxxw
reviewers: cubxxw reviewers: cubxxw
delete-branch: true delete-branch: true
title: "Bump League Patch auto PR: $(date +'%Y%m%d')"
body: | body: |
Review criteria: Review criteria:
- [ ] Disenchanter can connect and issue actions - [ ] Disenchanter can connect and issue actions
This is an automated PR. @ ${{ github.actor }} This is an automated PR. @ $(date +'%Y%m%d')
<sub>[workflow](https://github.com/openimsdk/open-im-server/blob/main/.github/workflows/pull-request.yml).</sub> <sub>[workflow](https://github.com/openimsdk/open-im-server/blob/main/.github/workflows/pull-request.yml).</sub>
base: main base: main
labels: | labels: |

@ -1,76 +0,0 @@
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: OpenIM executes the script validation code
on:
push:
branches:
- main
paths-ignore:
- "docs/**"
- "README.md"
- "README_zh-CN.md"
- "CONTRIBUTING.md"
pull_request:
branches:
- main
paths-ignore:
- "README.md"
- "README_zh-CN.md"
- "CONTRIBUTING.md"
- "docs/**"
env:
GO_VERSION: "1.19"
GOLANGCI_VERSION: "v1.50.1"
jobs:
openim:
name: Test with go ${{ matrix.go_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
contents: write
environment:
name: openim
strategy:
matrix:
go_version: ["1.21"]
os: [ubuntu-latest]
steps:
- name: Setup
uses: actions/checkout@v4
- name: In ${{ matrix.os }} Execute the script validation code
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go_version }}
id: go
- name: scripts validation
run: |
sudo make verify
continue-on-error: true
- name: verify format
run: |
sudo make format
continue-on-error: true
- name: verify license
run: |
sudo make verify-copyright
continue-on-error: true

@ -60,7 +60,7 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at reported to the community leaders responsible for enforcement at
3293172751nss@gmail.com. `security@openim.io`.
All complaints will be reviewed and investigated promptly and fairly. All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the All community leaders are obligated to respect the privacy and security of the

@ -186,7 +186,7 @@ We divide the problem into security and general problems:
Security issues are always treated seriously. As our usual principle, we discourage anyone to spread security issues. If you find a security issue of Open-IM-Server, please do not discuss it in public and even do not open a public issue. Security issues are always treated seriously. As our usual principle, we discourage anyone to spread security issues. If you find a security issue of Open-IM-Server, please do not discuss it in public and even do not open a public issue.
Instead we encourage you to send us a private email to winxu81@gmail.com to report this. Instead we encourage you to send us a private email to info@openim.io to report this.
#### Reporting general issues #### Reporting general issues
@ -369,7 +369,7 @@ Our most recommended way to get in touch is through [Slack](https://join.slack.c
In addition to Slack, we also offer the following ways to get in touch: In addition to Slack, we also offer the following ways to get in touch:
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" target="_blank"><img src="https://img.shields.io/badge/slack-%40OpenIMSDKCore-informational?logo=slack&style=flat-square"></a>: We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel. + <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" target="_blank"><img src="https://img.shields.io/badge/slack-%40OpenIMSDKCore-informational?logo=slack&style=flat-square"></a>: We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel.
+ <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=4closetool3@gmail.com" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a>: Get in touch with us on [Gmail](winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email. + <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=4closetool3@gmail.com" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a>: Get in touch with us on [Gmail](info@openim.io). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email.
+ <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a>: Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information. + <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a>: Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information.
+ <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a>: Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible. + <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a>: Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible.

@ -24,11 +24,9 @@ OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${OPENIM_ROOT}/scripts/lib/init.sh" source "${OPENIM_ROOT}/scripts/lib/init.sh"
# 定义一个配置文件数组,其中包含需要生成的配置文件的名称路径
# (en: Define a profile array that contains the name path of the profile to be generated.) # (en: Define a profile array that contains the name path of the profile to be generated.)
readonly ENV_FILE=${ENV_FILE:-"${OPENIM_ROOT}/scripts/install/environment.sh"} readonly ENV_FILE=${ENV_FILE:-"${OPENIM_ROOT}/scripts/install/environment.sh"}
# 定义关联数组,其中键是模板文件,值是对应的输出文件
# (en: Defines an associative array where the keys are the template files and the values are the corresponding output files.) # (en: Defines an associative array where the keys are the template files and the values are the corresponding output files.)
declare -A TEMPLATES=( declare -A TEMPLATES=(
["${OPENIM_ROOT}/deployments/templates/env_template.yaml"]="${OPENIM_ROOT}/.env" ["${OPENIM_ROOT}/deployments/templates/env_template.yaml"]="${OPENIM_ROOT}/.env"

@ -25,10 +25,10 @@ OPENIM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
LOCAL_OUTPUT_ROOT=""${OPENIM_ROOT}"/${OUT_DIR:-_output}" LOCAL_OUTPUT_ROOT=""${OPENIM_ROOT}"/${OUT_DIR:-_output}"
source "${OPENIM_ROOT}/scripts/lib/init.sh" source "${OPENIM_ROOT}/scripts/lib/init.sh"
#TODO: Access to the IP networks outside, or you want to use the IP network #TODO: Access to the OPENIM_IP networks outside, or you want to use the OPENIM_IP network
# IP=127.0.0.1 # OPENIM_IP=127.0.0.1
if [ -z "${IP}" ]; then if [ -z "${OPENIM_IP}" ]; then
IP=$(openim::util::get_server_ip) OPENIM_IP=$(openim::util::get_server_ip)
fi fi
# config.gateway custom bridge modes # config.gateway custom bridge modes
@ -49,14 +49,14 @@ def "DATA_DIR" "${OPENIM_ROOT}"
def "USER" "root" def "USER" "root"
# 设置统一的密码,方便记忆 # 设置统一的密码,方便记忆
def "PASSWORD" "openIM123" readonly PASSWORD=${PASSWORD:-'openIM123'}
# 设置统一的数据库名称,方便管理 # 设置统一的数据库名称,方便管理
def "DATABASE_NAME" "openIM_v3" def "DATABASE_NAME" "openIM_v3"
# Linux系统 openim 用户 # Linux系统 openim 用户
def "LINUX_USERNAME" "openim" def "LINUX_USERNAME" "openim"
def "LINUX_PASSWORD" "${PASSWORD}" readonly LINUX_PASSWORD=${LINUX_PASSWORD:-"${PASSWORD}"}
# 设置安装目录 # 设置安装目录
def "INSTALL_DIR" "${LOCAL_OUTPUT_ROOT}/installs" def "INSTALL_DIR" "${LOCAL_OUTPUT_ROOT}/installs"
@ -167,7 +167,8 @@ def "ZOOKEEPER_PASSWORD" "" # Zookeeper的密码
def "MYSQL_PORT" "13306" # MySQL的端口 def "MYSQL_PORT" "13306" # MySQL的端口
def "MYSQL_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MySQL的地址 def "MYSQL_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MySQL的地址
def "MYSQL_USERNAME" "${USER}" # MySQL的用户名 def "MYSQL_USERNAME" "${USER}" # MySQL的用户名
def "MYSQL_PASSWORD" "${PASSWORD}" # MySQL的密码 # MySQL的密码
readonly MYSQL_PASSWORD=${MYSQL_PASSWORD:-"${PASSWORD}"}
def "MYSQL_DATABASE" "${DATABASE_NAME}" # MySQL的数据库名 def "MYSQL_DATABASE" "${DATABASE_NAME}" # MySQL的数据库名
def "MYSQL_MAX_OPEN_CONN" "1000" # 最大打开的连接数 def "MYSQL_MAX_OPEN_CONN" "1000" # 最大打开的连接数
def "MYSQL_MAX_IDLE_CONN" "100" # 最大空闲连接数 def "MYSQL_MAX_IDLE_CONN" "100" # 最大空闲连接数
@ -181,12 +182,13 @@ def "MONGO_PORT" "37017" # MongoDB的端口
def "MONGO_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MongoDB的地址 def "MONGO_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # MongoDB的地址
def "MONGO_DATABASE" "${DATABASE_NAME}" # MongoDB的数据库名 def "MONGO_DATABASE" "${DATABASE_NAME}" # MongoDB的数据库名
def "MONGO_USERNAME" "${USER}" # MongoDB的用户名 def "MONGO_USERNAME" "${USER}" # MongoDB的用户名
def "MONGO_PASSWORD" "${PASSWORD}" # MongoDB的密码 # MongoDB的密码
readonly MONGO_PASSWORD=${MONGO_PASSWORD:-"${PASSWORD}"}
def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小 def "MONGO_MAX_POOL_SIZE" "100" # 最大连接池大小
###################### Object 配置信息 ###################### ###################### Object 配置信息 ######################
# app要能访问到此ip和端口或域名 # app要能访问到此ip和端口或域名
readonly API_URL=${API_URL:-"http://${IP}:${API_OPENIM_PORT}"} readonly API_URL=${API_URL:-"http://${OPENIM_IP}:${API_OPENIM_PORT}"}
def "OBJECT_ENABLE" "minio" # 对象是否启用 def "OBJECT_ENABLE" "minio" # 对象是否启用
# 对象的API地址 # 对象的API地址
@ -197,9 +199,9 @@ def "MINIO_PORT" "10005" # MinIO的端口
def MINIO_ADDRESS "${DOCKER_BRIDGE_GATEWAY}" def MINIO_ADDRESS "${DOCKER_BRIDGE_GATEWAY}"
readonly MINIO_ENDPOINT=${MINIO_ENDPOINT:-"http://${MINIO_ADDRESS}:${MINIO_PORT}"} readonly MINIO_ENDPOINT=${MINIO_ENDPOINT:-"http://${MINIO_ADDRESS}:${MINIO_PORT}"}
def "MINIO_ACCESS_KEY" "${USER}" # MinIO的访问密钥ID def "MINIO_ACCESS_KEY" "${USER}" # MinIO的访问密钥ID
def "MINIO_SECRET_KEY" "${PASSWORD}" # MinIO的密钥 readonly MINIO_SECRET_KEY=${MINIO_SECRET_KEY:-"${PASSWORD}"}
def "MINIO_SESSION_TOKEN" # MinIO的会话令牌 def "MINIO_SESSION_TOKEN" # MinIO的会话令牌
readonly MINIO_SIGN_ENDPOINT=${MINIO_SIGN_ENDPOINT:-"http://${IP}:${MINIO_PORT}"} # signEndpoint为minio公网地址 readonly MINIO_SIGN_ENDPOINT=${MINIO_SIGN_ENDPOINT:-"http://${OPENIM_IP}:${MINIO_PORT}"} # signEndpoint为minio公网地址
def "MINIO_PUBLIC_READ" "false" # 公有读 def "MINIO_PUBLIC_READ" "false" # 公有读
# 腾讯云COS的存储桶URL # 腾讯云COS的存储桶URL
@ -220,7 +222,7 @@ def "OSS_PUBLIC_READ" "false" # 公有
def "REDIS_PORT" "16379" # Redis的端口 def "REDIS_PORT" "16379" # Redis的端口
def "REDIS_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Redis的地址 def "REDIS_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # Redis的地址
def "REDIS_USERNAME" # Redis的用户名 def "REDIS_USERNAME" # Redis的用户名
def "REDIS_PASSWORD" "${PASSWORD}" # Redis的密码 readonly REDIS_PASSWORD=${REDIS_PASSWORD:-"${PASSWORD}"}
###################### Kafka 配置信息 ###################### ###################### Kafka 配置信息 ######################
def "KAFKA_USERNAME" # `Kafka` 的用户名 def "KAFKA_USERNAME" # `Kafka` 的用户名
@ -329,7 +331,8 @@ def "RETAIN_CHAT_RECORDS" "365" # 保留聊天记录
readonly CHAT_RECORDS_CLEAR_TIME=${CHAT_RECORDS_CLEAR_TIME:-'0 2 * * 3'} readonly CHAT_RECORDS_CLEAR_TIME=${CHAT_RECORDS_CLEAR_TIME:-'0 2 * * 3'}
# 消息销毁时间 # 消息销毁时间
readonly MSG_DESTRUCT_TIME=${MSG_DESTRUCT_TIME:-'0 2 * * *'} readonly MSG_DESTRUCT_TIME=${MSG_DESTRUCT_TIME:-'0 2 * * *'}
def "SECRET" "${PASSWORD}" # 密钥 # 密钥
readonly SECRET=${SECRET:-"${PASSWORD}"}
def "TOKEN_EXPIRE" "90" # Token到期时间 def "TOKEN_EXPIRE" "90" # Token到期时间
def "FRIEND_VERIFY" "false" # 朋友验证 def "FRIEND_VERIFY" "false" # 朋友验证
def "IOS_PUSH_SOUND" "xxx" # IOS推送声音 def "IOS_PUSH_SOUND" "xxx" # IOS推送声音

@ -1,561 +1,332 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright © 2023 OpenIM. All rights reserved. # The root of the build/dist directory
# IAM_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
# Licensed under the Apache License, Version 2.0 (the "License"); [[ -z ${COMMON_SOURCED} ]] && source ${IAM_ROOT}/scripts/install/common.sh
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# A set of helpers for tests
openim::test::clear_all() {
if openim::test::if_supports_resource "rc" ; then
# shellcheck disable=SC2154
# Disabling because "kube_flags" is set in a parent script
kubectl delete "${kube_flags[@]}" rc --all --grace-period=0 --force
fi
if openim::test::if_supports_resource "pods" ; then
kubectl delete "${kube_flags[@]}" pods --all --grace-period=0 --force
fi
}
# Prints the calling file and line number $1 levels deep # API Server API Address:Port
# Defaults to 2 levels so you can call this to find your own caller INSECURE_OPENIMAPI=${IAM_APISERVER_HOST}:${API_OPENIM_PORT}
openim::test::get_caller() { INSECURE_OPENIMAUTO=${OPENIM_RPC_AUTH_HOST}:${OPENIM_AUTH_PORT}
local levels=${1:-2}
local caller_file="${BASH_SOURCE[${levels}]}" Header="-HContent-Type: application/json"
local caller_line="${BASH_LINENO[${levels}-1]}" CCURL="curl -f -s -XPOST" # Create
echo "$(basename "${caller_file}"):${caller_line}" UCURL="curl -f -s -XPUT" # Update
} RCURL="curl -f -s -XGET" # Retrieve
DCURL="curl -f -s -XDELETE" # Delete
openim::test::user()
{
token="-HAuthorization: Bearer $(openim::test::login)"
# 1. If colin, mark, john users exist, clear them first
${DCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/users/colin; echo
${DCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/users/mark; echo
${DCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/users/john; echo
# 2. Create colin, mark, john users
${CCURL} "${Header}" "${token}" http://${INSECURE_OPENIMAPI}/v1/users \
-d'{"password":"User@2021","metadata":{"name":"colin"},"nickname":"colin","email":"colin@foxmail.com","phone":"1812884xxxx"}'; echo
# 3. List all users
${RCURL} "${token}" "http://${INSECURE_OPENIMAPI}/v1/users?offset=0&limit=10"; echo
# 4. Get detailed information of colin user
${RCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/users/colin; echo
# 5. Modify colin user
${UCURL} "${Header}" "${token}" http://${INSECURE_OPENIMAPI}/v1/users/colin \
-d'{"nickname":"colin","email":"colin_modified@foxmail.com","phone":"1812884xxxx"}'; echo
# 6. Delete colin user
${DCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/users/colin; echo
# Force exact match of a returned result for a object query. Wrap this with || to support multiple # 7. Batch delete users
# valid return types. ${DCURL} "${token}" "http://${INSECURE_OPENIMAPI}/v1/users?name=mark&name=john"; echo
# This runs `kubectl get` once and asserts that the result is as expected.
# $1: Object on which get should be run openim::log::info "$(echo -e '\033[32mcongratulations, /v1/user test passed!\033[0m')"
# $2: The go-template to run on the result
# $3: The expected output
# $4: Additional args to be passed to kubectl
openim::test::get_object_assert() {
openim::test::object_assert 1 "$@"
} }
# Asserts that the output of a given get query is as expected. # userRouterGroup := r.Group("/user")
# Runs the query multiple times before failing it. # {
# $1: Object on which get should be run # userRouterGroup.POST("/user_register", u.UserRegister)
# $2: The go-template to run on the result # userRouterGroup.POST("/update_user_info", ParseToken, u.UpdateUserInfo)
# $3: The expected output # userRouterGroup.POST("/set_global_msg_recv_opt", ParseToken, u.SetGlobalRecvMessageOpt)
# $4: Additional args to be passed to kubectl # userRouterGroup.POST("/get_users_info", ParseToken, u.GetUsersPublicInfo)
openim::test::wait_object_assert() { # userRouterGroup.POST("/get_all_users_uid", ParseToken, u.GetAllUsersID)
openim::test::object_assert 10 "$@" # userRouterGroup.POST("/account_check", ParseToken, u.AccountCheck)
# userRouterGroup.POST("/get_users", ParseToken, u.GetUsers)
# userRouterGroup.POST("/get_users_online_status", ParseToken, u.GetUsersOnlineStatus)
# userRouterGroup.POST("/get_users_online_token_detail", ParseToken, u.GetUsersOnlineTokenDetail)
# userRouterGroup.POST("/subscribe_users_status", ParseToken, u.SubscriberStatus)
# userRouterGroup.POST("/get_users_status", ParseToken, u.GetUserStatus)
# userRouterGroup.POST("/get_subscribe_users_status", ParseToken, u.GetSubscribeUsersStatus)
# }
openim::test::group()
{
token="-HAuthorization: Bearer $(openim::test::login)"
} }
# Asserts that the output of a given get query is as expected. # Define a function to register a user
# Can run the query multiple times before failing it. openim::register_user()
# $1: Number of times the query should be run before failing it. {
# $2: Object on which get should be run user_register_response=$(${CCURL} "${Header}" http://localhost:10002/user/user_register \
# $3: The go-template to run on the result -d'{
# $4: The expected output "secret": "openIM123",
# $5: Additional args to be passed to kubectl "users": [{"userID": "11111112","nickname": "yourNickname","faceURL": "yourFaceURL"}]
openim::test::object_assert() { }')
local tries=$1
local object=$2 echo "$user_register_response"
local request=$3
local expected=$4
local args=${5:-}
for j in $(seq 1 "${tries}"); do
# shellcheck disable=SC2086
# Disabling because to allow for expansion here
res=$(kubectl get "${kube_flags[@]}" ${args} ${object} -o go-template="${request}")
if [[ "${res}" =~ ^$expected$ ]]; then
echo -n "${green}"
echo "$(openim::test::get_caller 3): Successful get ${object} ${request}: ${res}"
echo -n "${reset}"
return 0
fi
echo "Waiting for Get ${object} ${request} ${args}: expected: ${expected}, got: ${res}"
sleep $((j-1))
done
echo "${bold}${red}"
echo "$(openim::test::get_caller 3): FAIL!"
echo "Get ${object} ${request}"
echo " Expected: ${expected}"
echo " Got: ${res}"
echo "${reset}${red}"
caller
echo "${reset}"
return 1
} }
openim::test::get_object_jsonpath_assert() { # Define a function to get a token
local object=$1 openim::get_token()
local request=$2 {
local expected=$3 token_response=$(${CCURL} "${Header}" http://localhost:10002/auth/user_token \
-d'{
"secret": "openIM123",
"platformID": 1,
"userID": "11111112"
}')
token=$(echo $token_response | grep -Po 'token[" :]+\K[^"]+')
echo "$token"
}
# shellcheck disable=SC2086 # Define a function to check the account
# Disabling to allow for expansion here openim::check_account()
res=$(kubectl get "${kube_flags[@]}" ${object} -o jsonpath=${request}) {
local token=$1
account_check_response=$(${CCURL} "${Header}" -H"operationID: 1646445464564" -H"token: ${token}" http://localhost:10002/user/account_check \
-d'{
"checkUserIDs": ["11111111","11111112"]
}')
if [[ "${res}" =~ ^$expected$ ]]; then echo "$account_check_response"
echo -n "${green}"
echo "$(openim::test::get_caller): Successful get ${object} ${request}: ${res}"
echo -n "${reset}"
return 0
else
echo "${bold}${red}"
echo "$(openim::test::get_caller): FAIL!"
echo "Get ${object} ${request}"
echo " Expected: ${expected}"
echo " Got: ${res}"
echo "${reset}${red}"
caller
echo "${reset}"
return 1
fi
} }
openim::test::describe_object_assert() { # Define a function to register, get a token and check the account
local resource=$1 openim::register_and_check()
local object=$2 {
local matches=( "${@:3}" ) # Register a user
user_register_response=$(openim::register_user)
# shellcheck disable=SC2086 if [[ $user_register_response == *"errCode": 0* ]]; then
# Disabling to allow for expansion here echo "User registration successful."
result=$(kubectl describe "${kube_flags[@]}" ${resource} ${object})
for match in "${matches[@]}"; do # Get token
if grep -q "${match}" <<< "${result}"; then token=$(openim::get_token)
echo "matched ${match}"
else
echo "${bold}${red}"
echo "$(openim::test::get_caller): FAIL!"
echo "Describe ${resource} ${object}"
echo " Expected Match: ${match}"
echo " Not found in:"
echo "${result}"
echo "${reset}${red}"
caller
echo "${reset}"
return 1
fi
done
echo -n "${green}" if [[ -n $token ]]; then
echo "$(openim::test::get_caller): Successful describe ${resource} ${object}:" echo "Token acquired: $token"
echo "${result}"
echo -n "${reset}"
return 0
}
openim::test::describe_object_events_assert() { # Check account
local resource=$1 account_check_response=$(openim::check_account $token)
local object=$2
local showevents=${3:-"true"}
# shellcheck disable=SC2086 if [[ $account_check_response == *"errCode": 0* ]]; then
# Disabling to allow for expansion here echo "Account check successful."
if [[ -z "${3:-}" ]]; then
result=$(kubectl describe "${kube_flags[@]}" ${resource} ${object})
else else
result=$(kubectl describe "${kube_flags[@]}" "--show-events=${showevents}" ${resource} ${object}) echo "Account check failed."
fi fi
if grep -q "No events.\|Events:" <<< "${result}"; then
local has_events="true"
else else
local has_events="false" echo "Failed to acquire token."
fi fi
if [[ "${showevents}" == "${has_events}" ]]; then
echo -n "${green}"
echo "$(openim::test::get_caller): Successful describe"
echo "${result}"
echo "${reset}"
return 0
else
echo "${bold}${red}"
echo "$(openim::test::get_caller): FAIL"
if [[ "${showevents}" == "false" ]]; then
echo " Events information should not be described in:"
else else
echo " Events information not found in:" echo "User registration failed."
fi
echo "${result}"
echo "${reset}${red}"
caller
echo "${reset}"
return 1
fi fi
} }
openim::test::describe_resource_assert() {
local resource=$1
local matches=( "${@:2}" )
# shellcheck disable=SC2086 openim::test::secret()
# Disabling to allow for expansion here {
result=$(kubectl describe "${kube_flags[@]}" ${resource}) token="-HAuthorization: Bearer $(openim::test::login)"
for match in "${matches[@]}"; do # 1. 如果有 secret0 密钥先清空
if grep -q "${match}" <<< "${result}"; then ${DCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/secrets/secret0; echo
echo "matched ${match}"
else
echo "${bold}${red}"
echo "FAIL!"
echo "Describe ${resource}"
echo " Expected Match: ${match}"
echo " Not found in:"
echo "${result}"
echo "${reset}${red}"
caller
echo "${reset}"
return 1
fi
done
echo -n "${green}" # 2. 创建 secret0 密钥
echo "Successful describe ${resource}:" ${CCURL} "${Header}" "${token}" http://${INSECURE_OPENIMAPI}/v1/secrets \
echo "${result}" -d'{"metadata":{"name":"secret0"},"expires":0,"description":"admin secret"}'; echo
echo -n "${reset}"
return 0
}
openim::test::describe_resource_events_assert() { # 3. 列出所有密钥
local resource=$1 ${RCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/secrets; echo
local showevents=${2:-"true"}
# shellcheck disable=SC2086 # 4. 获取 secret0 密钥的详细信息
# Disabling to allow for expansion here ${RCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/secrets/secret0; echo
result=$(kubectl describe "${kube_flags[@]}" "--show-events=${showevents}" ${resource})
if grep -q "No events.\|Events:" <<< "${result}"; then # 5. 修改 secret0 密钥
local has_events="true" ${UCURL} "${Header}" "${token}" http://${INSECURE_OPENIMAPI}/v1/secrets/secret0 \
else -d'{"expires":0,"description":"admin secret(modified)"}'; echo
local has_events="false"
fi # 6. 删除 secret0 密钥
if [[ "${showevents}" == "${has_events}" ]]; then ${DCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/secrets/secret0; echo
echo -n "${green}" openim::log::info "$(echo -e '\033[32mcongratulations, /v1/secret test passed!\033[0m')"
echo "Successful describe"
echo "${result}"
echo -n "${reset}"
return 0
else
echo "${bold}${red}"
echo "FAIL"
if [[ "${showevents}" == "false" ]]; then
echo " Events information should not be described in:"
else
echo " Events information not found in:"
fi
echo "${result}"
caller
echo "${reset}"
return 1
fi
} }
openim::test::describe_resource_chunk_size_assert() { openim::test::policy()
# $1: the target resource {
local resource=$1 token="-HAuthorization: Bearer $(openim::test::login)"
# $2: comma-separated list of additional resources that will be listed
local additionalResources=${2:-}
# Remaining args are flags to pass to kubectl
local args=${3:-}
# Expect list requests for the target resource and the additional resources
local expectLists
IFS="," read -r -a expectLists <<< "${resource},${additionalResources}"
# shellcheck disable=SC2086
# Disabling to allow for expansion here
defaultResult=$(kubectl describe ${resource} --show-events=true -v=6 ${args} "${kube_flags[@]}" 2>&1 >/dev/null)
for r in "${expectLists[@]}"; do
if grep -q "${r}?.*limit=500" <<< "${defaultResult}"; then
echo "query for ${r} had limit param"
else
echo "${bold}${red}"
echo "FAIL!"
echo "Describe ${resource}"
echo " Expected limit param on request for: ${r}"
echo " Not found in:"
echo "${defaultResult}"
echo "${reset}${red}"
caller
echo "${reset}"
return 1
fi
done
# shellcheck disable=SC2086
# Disabling to allow for expansion here
# Try a non-default chunk size
customResult=$(kubectl describe ${resource} --show-events=false --chunk-size=10 -v=6 ${args} "${kube_flags[@]}" 2>&1 >/dev/null)
if grep -q "${resource}?limit=10" <<< "${customResult}"; then
echo "query for ${resource} had user-specified limit param"
else
echo "${bold}${red}"
echo "FAIL!"
echo "Describe ${resource}"
echo " Expected limit param on request for: ${r}"
echo " Not found in:"
echo "${customResult}"
echo "${reset}${red}"
caller
echo "${reset}"
return 1
fi
echo -n "${green}" # 1. 如果有 policy0 策略先清空
echo "Successful describe ${resource} verbose logs:" ${DCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/policies/policy0; echo
echo "${defaultResult}"
echo -n "${reset}"
return 0 # 2. 创建 policy0 策略
} ${CCURL} "${Header}" "${token}" http://${INSECURE_OPENIMAPI}/v1/policies \
-d'{"metadata":{"name":"policy0"},"policy":{"description":"One policy to rule them all.","subjects":["users:<peter|ken>","users:maria","groups:admins"],"actions":["delete","<create|update>"],"effect":"allow","resources":["resources:articles:<.*>","resources:printer"],"conditions":{"remoteIPAddress":{"type":"CIDRCondition","options":{"cidr":"192.168.0.1/16"}}}}}'; echo
# 3. 列出所有策略
${RCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/policies; echo
# Compare sort-by resource name output (first column, skipping first line) with expected order specify in the last parameter # 4. 获取 policy0 策略的详细信息
openim::test::if_sort_by_has_correct_order() { ${RCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/policies/policy0; echo
local var
var="$(echo "$1" | awk '{if(NR!=1) print $1}' | tr '\n' ':')" # 5. 修改 policy0 策略
openim::test::if_has_string "${var}" "${@:$#}" ${UCURL} "${Header}" "${token}" http://${INSECURE_OPENIMAPI}/v1/policies/policy0 \
-d'{"policy":{"description":"One policy to rule them all(modified).","subjects":["users:<peter|ken>","users:maria","groups:admins"],"actions":["delete","<create|update>"],"effect":"allow","resources":["resources:articles:<.*>","resources:printer"],"conditions":{"remoteIPAddress":{"type":"CIDRCondition","options":{"cidr":"192.168.0.1/16"}}}}}'; echo
# 6. 删除 policy0 策略
${DCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/policies/policy0; echo
openim::log::info "$(echo -e '\033[32mcongratulations, /v1/policy test passed!\033[0m')"
} }
openim::test::if_has_string() { openim::test::apiserver()
local message=$1 {
local match=$2 openim::test::user
openim::test::secret
if grep -q "${match}" <<< "${message}"; then openim::test::policy
echo -n "${green}" openim::log::info "$(echo -e '\033[32mcongratulations, openim-apiserver test passed!\033[0m')"
echo "Successful"
echo -n "${reset}"
echo "message:${message}"
echo "has:${match}"
return 0
else
echo -n "${bold}${red}"
echo "FAIL!"
echo -n "${reset}"
echo "message:${message}"
echo "has not:${match}"
caller
return 1
fi
} }
openim::test::if_has_not_string() { openim::test::authz()
local message=$1 {
local match=$2 token="-HAuthorization: Bearer $(openim::test::login)"
if grep -q "${match}" <<< "${message}"; then # 1. 如果有 authzpolicy 策略先清空
echo -n "${bold}${red}" ${DCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/policies/authzpolicy; echo
echo "FAIL!"
echo -n "${reset}" # 2. 创建 authzpolicy 策略
echo "message:${message}" ${CCURL} "${Header}" "${token}" http://${INSECURE_OPENIMAPI}/v1/policies \
echo "has:${match}" -d'{"metadata":{"name":"authzpolicy"},"policy":{"description":"One policy to rule them all.","subjects":["users:<peter|ken>","users:maria","groups:admins"],"actions":["delete","<create|update>"],"effect":"allow","resources":["resources:articles:<.*>","resources:printer"],"conditions":{"remoteIPAddress":{"type":"CIDRCondition","options":{"cidr":"192.168.0.1/16"}}}}}'; echo
caller
# 3. 如果有 authzsecret 密钥先清空
${DCURL} "${token}" http://${INSECURE_OPENIMAPI}/v1/secrets/authzsecret; echo
# 4. 创建 authzsecret 密钥
secret=$(${CCURL} "${Header}" "${token}" http://${INSECURE_OPENIMAPI}/v1/secrets -d'{"metadata":{"name":"authzsecret"},"expires":0,"description":"admin secret"}')
secretID=$(echo ${secret} | grep -Po 'secretID[" :]+\K[^"]+')
secretKey=$(echo ${secret} | grep -Po 'secretKey[" :]+\K[^"]+')
# 5. 生成 token
token=$(iamctl jwt sign ${secretID} ${secretKey})
# 6. 调用 /v1/authz 完成资源授权。
# 注意这里要 sleep 3s 等待 openim-authz-server 将新建的密钥同步到其内存中
echo "wait 3s to allow openim-authz-server to sync information into its memory ..."
sleep 3
ret=`$CCURL "${Header}" -H"Authorization: Bearer ${token}" http://${INSECURE_OPENIMAUTO}/v1/authz \
-d'{"subject":"users:maria","action":"delete","resource":"resources:articles:ladon-introduction","context":{"remoteIPAddress":"192.168.0.5"}}' | grep -Po 'allowed[" :]+\K\w+'`
if [ "$ret" != "true" ];then
return 1 return 1
else
echo -n "${green}"
echo "Successful"
echo -n "${reset}"
echo "message:${message}"
echo "has not:${match}"
return 0
fi fi
openim::log::info "$(echo -e '\033[32mcongratulations, /v1/authz test passed!\033[0m')"
} }
openim::test::if_empty_string() { openim::test::authzserver()
local match=$1 {
if [ -n "${match}" ]; then openim::test::authz
echo -n "${bold}${red}" openim::log::info "$(echo -e '\033[32mcongratulations, openim-authz-server test passed!\033[0m')"
echo "FAIL!"
echo "${match} is not empty"
echo -n "${reset}"
caller
return 1
else
echo -n "${green}"
echo "Successful"
echo -n "${reset}"
return 0
fi
} }
# Returns true if the required resource is part of supported resources. openim::test::pump()
# Expects env vars: {
# SUPPORTED_RESOURCES: Array of all resources supported by the apiserver. "*" ${RCURL} http://${IAM_PUMP_HOST}:7070/healthz | egrep -q 'status.*ok' || {
# means it supports all resources. For ex: ("*") or ("rc" "*") both mean that openim::log::error "cannot access openim-pump healthz api, openim-pump maybe down"
# all resources are supported.
# $1: Name of the resource to be tested.
openim::test::if_supports_resource() {
SUPPORTED_RESOURCES=${SUPPORTED_RESOURCES:-""}
REQUIRED_RESOURCE=${1:-""}
for r in "${SUPPORTED_RESOURCES[@]}"; do
if [[ "${r}" == "*" || "${r}" == "${REQUIRED_RESOURCE}" ]]; then
return 0
fi
done
return 1 return 1
} }
openim::test::version::object_to_file() { openim::test::real_pump_test
name=$1
flags=${2:-""}
file=$3
# shellcheck disable=SC2086
# Disabling because "flags" needs to allow for expansion here
kubectl version ${flags} | grep "${name} Version:" | sed -e s/"${name} Version: "/""/g > "${file}"
}
openim::test::version::json_object_to_file() { openim::log::info "$(echo -e '\033[32mcongratulations, openim-pump test passed!\033[0m')"
flags=$1
file=$2
# shellcheck disable=SC2086
# Disabling because "flags" needs to allow for expansion here
kubectl version ${flags} --output json | sed -e s/' '/''/g -e s/'\"'/''/g -e s/'}'/''/g -e s/'{'/''/g -e s/'clientVersion:'/'clientVersion:,'/ -e s/'serverVersion:'/'serverVersion:,'/ | tr , '\n' > "${file}"
} }
openim::test::version::json_client_server_object_to_file() { # 使用真实的数据测试 openim-pump 是否正常工作
flags=$1 openim::test::real_pump_test()
name=$2 {
file=$3 # 1. 创建访问 openim-authz-server 需要用到的密钥对
# shellcheck disable=SC2086 iamctl secret create pumptest &>/dev/null
# Disabling because "flags" needs to allow for expansion here
kubectl version ${flags} --output json | jq -r ".${name}" | sed -e s/'\"'/''/g -e s/'}'/''/g -e s/'{'/''/g -e /^$/d -e s/','/''/g -e s/':'/'='/g > "${file}"
}
openim::test::version::yaml_object_to_file() { # 2. 使用步骤 1 创建的密钥对生成 JWT Token
flags=$1 authzAccessToken=`iamctl jwt sign njcho8gJQArsq7zr5v1YpG5NcvL0aeuZ38Ti if70HgRgp021iq5ex2l7pfy5XvgtZM3q` # iamctl jwt sign $secretID $secretKey
file=$2
# shellcheck disable=SC2086
# Disabling because "flags" needs to allow for expansion here
kubectl version ${flags} --output yaml | sed -e s/' '/''/g -e s/'\"'/''/g -e /^$/d > "${file}"
}
openim::test::version::diff_assert() { # 3. 创建授权策略
local original=$1 iamctl policy create pumptest '{"metadata":{"name":"policy0"},"policy":{"description":"One policy to rule them all.","subjects":["users:<peter|ken>","users:maria","groups:admins"],"actions":["delete","<create|update>"],"effect":"allow","resources":["resources:articles:<.*>","resources:printer"],"conditions":{"remoteIPAddress":{"type":"CIDRCondition","options":{"cidr":"192.168.0.1/16"}}}}}' &>/dev/null
local comparator=${2:-"eq"}
local latest=$3
local diff_msg=${4:-""}
local res=""
if [ ! -f "${original}" ]; then
echo "${bold}${red}"
echo "FAIL! ${diff_msg}"
echo "the file '${original}' does not exit"
echo "${reset}${red}"
caller
echo "${reset}"
return 1
fi
if [ ! -f "${latest}" ]; then # 注意这里要 sleep 3s 等待 openim-authz-server 将新建的密钥和授权策略同步到其内存中
echo "${bold}${red}" echo "wait 3s to allow openim-authz-server to sync information into its memory ..."
echo "FAIL! ${diff_msg}" sleep 3
echo "the file '${latest}' does not exit"
echo "${reset}${red}" # 4. 访问 /v1/authz 接口进行资源授权
caller $CCURL "${Header}" -H"Authorization: Bearer ${token}" http://${INSECURE_OPENIMAUTO}/v1/authz \
echo "${reset}" -d'{"subject":"users:maria","action":"delete","resource":"resources:articles:ladon-introduction","context":{"remoteIPAddress":"192.168.0.5"}}' &>/dev/null
# 这里要 sleep 5s等待 openim-pump 将 Redis 中的日志,分析并转存到 MongoDB 中
echo "wait 10s to allow openim-pump analyze and dump authorization log into MongoDB ..."
sleep 10
# 5. 查看 MongoDB 中是否有经过解析后的授权日志。
echo "db.iam_analytics.find()" | mongosh --quiet "${IAM_PUMP_MONGO_URL}" | grep -q "allow access" || {
openim::log::error "cannot find analyzed authorization log in MongoDB"
return 1 return 1
fi }
}
if [ "${comparator}" == "exact" ]; then openim::test::watcher()
# Skip sorting of file content for exact comparison. {
cp "${original}" "${original}.sorted" ${RCURL} http://${IAM_WATCHER_HOST}:5050/healthz | egrep -q 'status.*ok' || {
cp "${latest}" "${latest}.sorted" openim::log::error "cannot access openim-watcher healthz api, openim-watcher maybe down"
else return 1
sort "${original}" > "${original}.sorted" }
sort "${latest}" > "${latest}.sorted" openim::log::info "$(echo -e '\033[32mcongratulations, openim-watcher test passed!\033[0m')"
fi }
if [ "${comparator}" == "eq" ] || [ "${comparator}" == "exact" ]; then openim::test::iamctl()
if [ "$(diff -iwB "${original}".sorted "${latest}".sorted)" == "" ] ; then {
echo -n "${green}" iamctl user list | egrep -q admin || {
echo "Successful: ${diff_msg}" openim::log::error "iamctl cannot list users from openim-apiserver"
echo -n "${reset}"
return 0
else
echo "${bold}${red}"
echo "FAIL! ${diff_msg}"
echo " Expected: "
cat "${original}"
echo " Got: "
cat "${latest}"
echo "${reset}${red}"
caller
echo "${reset}"
return 1 return 1
fi }
else openim::log::info "$(echo -e '\033[32mcongratulations, iamctl test passed!\033[0m')"
if [ -n "$(diff -iwB "${original}".sorted "${latest}".sorted)" ] ; then }
echo -n "${green}"
echo "Successful: ${diff_msg}" openim::test::man()
echo -n "${reset}" {
return 0 man openim-apiserver | grep -q 'OPENIM API Server' || {
else openim::log::error "openim man page not installed or may not installed properly"
echo "${bold}${red}"
echo "FAIL! ${diff_msg}"
echo " Expected: "
cat "${original}"
echo " Got: "
cat "${latest}"
echo "${reset}${red}"
caller
echo "${reset}"
return 1 return 1
fi }
fi openim::log::info "$(echo -e '\033[32mcongratulations, man test passed!\033[0m')"
} }
# Force exact match of kubectl stdout, stderr, and return code. # OpenIM Smoke Test
# $1: file with actual stdout openim::test::smoke()
# $2: file with actual stderr {
# $3: the actual return code openim::test::apiserver
# $4: file with expected stdout openim::test::authzserver
# $5: file with expected stderr openim::test::pump
# $6: expected return code openim::test::watcher
# $7: additional message describing the invocation openim::test::iamctl
openim::test::results::diff() { openim::log::info "$(echo -e '\033[32mcongratulations, smoke test passed!\033[0m')"
local actualstdout=$1 }
local actualstderr=$2
local actualcode=$3
local expectedstdout=$4
local expectedstderr=$5
local expectedcode=$6
local message=$7
local result=0
if ! openim::test::version::diff_assert "${expectedstdout}" "exact" "${actualstdout}" "stdout for ${message}"; then
result=1
fi
if ! openim::test::version::diff_assert "${expectedstderr}" "exact" "${actualstderr}" "stderr for ${message}"; then
result=1
fi
if [ "${actualcode}" -ne "${expectedcode}" ]; then
echo "${bold}${red}"
echo "$(openim::test::get_caller): FAIL!"
echo "Return code for ${message}"
echo " Expected: ${expectedcode}"
echo " Got: ${actualcode}"
echo "${reset}${red}"
caller
echo "${reset}"
result=1
fi
if [ "${result}" -eq 0 ]; then # OpenIM Test
echo -n "${green}" openim::test::test()
echo "$(openim::test::get_caller): Successful: ${message}" {
echo -n "${reset}" openim::test::smoke
fi openim::test::man
return "$result" openim::log::info "$(echo -e '\033[32mcongratulations, all test passed!\033[0m')"
} }
if [[ "$*" =~ openim::test:: ]];then
eval $*
fi

@ -102,27 +102,24 @@ endif
# The OS can be linux/windows/darwin when building binaries # The OS can be linux/windows/darwin when building binaries
PLATFORMS ?= linux_s390x linux_mips64 linux_mips64le darwin_amd64 windows_amd64 linux_amd64 linux_arm64 linux_ppc64le # wasip1_wasm PLATFORMS ?= linux_s390x linux_mips64 linux_mips64le darwin_amd64 windows_amd64 linux_amd64 linux_arm64 linux_ppc64le # wasip1_wasm
# only support linux
GOOS=linux
# set a specific PLATFORM, defaults to the host platform # set a specific PLATFORM, defaults to the host platform
ifeq ($(origin PLATFORM), undefined) ifeq ($(origin PLATFORM), undefined)
ifeq ($(origin GOARCH), undefined) ifeq ($(origin GOARCH), undefined)
GOARCH := $(shell go env GOARCH) GOARCH := $(shell go env GOARCH)
endif endif
ifeq ($(origin GOARCH), undefined) # Determine the host OS
GOARCH := $(shell go env GOARCH) GOOS := $(shell go env GOOS)
endif
PLATFORM := $(GOOS)_$(GOARCH) PLATFORM := $(GOOS)_$(GOARCH)
# Use linux as the default OS when building images # Use the host OS and GOARCH as the default when building images
IMAGE_PLAT := linux_$(GOARCH) IMAGE_PLAT := $(PLATFORM)
else else
# such as: PLATFORM = linux_amd64 # Parse the PLATFORM variable
GOOS := $(word 1, $(subst _, ,$(PLATFORM))) GOOS := $(word 1, $(subst _, ,$(PLATFORM)))
GOARCH := $(word 2, $(subst _, ,$(PLATFORM))) GOARCH := $(word 2, $(subst _, ,$(PLATFORM)))
IMAGE_PLAT := $(PLATFORM) IMAGE_PLAT := $(PLATFORM)
endif endif
# Protobuf file storage path # Protobuf file storage path
APIROOT=$(ROOT_DIR)/pkg/proto APIROOT=$(ROOT_DIR)/pkg/proto

@ -8,11 +8,11 @@ If you encounter any problems during its usage, please create an issue in the [G
**Here are some ways to get involved with the OpenIM community:** **Here are some ways to get involved with the OpenIM community:**
📢 **Slack Channel**: Join our Slack channels for discussions, communication, and support. Click [here](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) to join the Open-IM-Server Slack team channel. 📢 **Slack Channel**: Join our Slack channels for discussions, communication, and support. Click [here](https://openimsdk.slack.com) to join the Open-IM-Server Slack team channel.
📧 **Gmail Contact**: If you have any questions, suggestions, or feedback for our open-source projects, please feel free to [contact us via email](https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=winxu81@gmail.com). 📧 **Gmail Contact**: If you have any questions, suggestions, or feedback for our open-source projects, please feel free to [contact us via email](https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=info@openim.io).
📖 **Blog**: Stay up-to-date with OpenIM-Server projects and trends by reading our [blog](https://doc.rentsoft.cn/). We share the latest developments, tech trends, and other interesting information related to OpenIM. 📖 **Blog**: Stay up-to-date with OpenIM-Server projects and trends by reading our [blog](https://openim.io/). We share the latest developments, tech trends, and other interesting information related to OpenIM.
📱 **WeChat**: Add us on WeChat (QR Code) and indicate that you are a user or developer of Open-IM-Server. We'll process your request as soon as possible. 📱 **WeChat**: Add us on WeChat (QR Code) and indicate that you are a user or developer of Open-IM-Server. We'll process your request as soon as possible.

@ -21,7 +21,7 @@ import (
) )
func main() { func main() {
rawJWT := `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJpYW0uYXV0aHoubWFybW90ZWR1LmNvbSIsImV4cCI6MTYwNDEyODQwMywiaWF0IjoxNjA0MTI4NDAyLCJpc3MiOiJpYW1jdGwiLCJraWQiOiJpZDEifQ.Itr5u4C-nTeA01qbjjl7RzuPD-aSQazsJZY_Z25aGnI` rawJWT := `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiI4MjkzODEzMTgzIiwiUGxhdGZvcm1JRCI6NSwiZXhwIjoxNzA2NTk0MTU0LCJuYmYiOjE2OTg4MTc4NTQsImlhdCI6MTY5ODgxODE1NH0.QCJHzU07SC6iYBoFO6Zsm61TNDor2D89I4E3zg8HHHU`
// Verify the token // Verify the token
claims := &jwt.MapClaims{} claims := &jwt.MapClaims{}

Loading…
Cancel
Save