NOISSUE - Rename to Magistrala (#3427)

Signed-off-by: dusan <borovcanindusan1@gmail.com>
This commit is contained in:
Dušan Borovčanin
2026-04-06 15:23:42 +02:00
committed by GitHub
parent fc679e9982
commit 61d0427898
898 changed files with 4896 additions and 4771 deletions
+1 -1
View File
@@ -1 +1 @@
* @absmach/supermq
* @absmach/magistrala
+2 -2
View File
@@ -5,7 +5,7 @@ blank_issues_enabled: false
contact_links:
- name: Google group
url: https://groups.google.com/forum/#!forum/mainflux
about: Join the SuperMQ community on Google group.
about: Join the Magistrala community on Google group.
- name: Gitter
url: https://gitter.im/mainflux/mainflux
about: Join the SuperMQ community on Gitter.
about: Join the Magistrala community on Gitter.
+2 -2
View File
@@ -3,8 +3,8 @@ SPDX-License-Identifier: Apache-2.0 -->
<!--
Pull request title should be `SMQ-XXX - description` or `NOISSUE - description` where XXX is ID of the issue that this PR relate to.
Please review the [CONTRIBUTING.md](https://github.com/absmach/supermq/blob/main/CONTRIBUTING.md) file for detailed contributing guidelines.
Pull request title should be `MG-XXX - description` or `NOISSUE - description` where XXX is ID of the issue that this PR relate to.
Please review the [CONTRIBUTING.md](https://github.com/absmach/magistrala/blob/main/CONTRIBUTING.md) file for detailed contributing guidelines.
For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details.
+2 -2
View File
@@ -7,7 +7,7 @@ SPDX-License-Identifier: Apache-2.0
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SuperMQ API Documentation</title>
<title>Magistrala API Documentation</title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.30.3/swagger-ui.css">
<style>
body {
@@ -101,7 +101,7 @@ SPDX-License-Identifier: Apache-2.0
</head>
<body>
<div class="service-selector">
<h1>SuperMQ API Documentation</h1>
<h1>Magistrala API Documentation</h1>
<div class="service-dropdown-container">
<label for="serviceDropdown">Select Service:</label>
<select id="serviceDropdown" class="service-dropdown"></select>
+1 -1
View File
@@ -174,7 +174,7 @@ jobs:
export USER_TOKEN=$(curl -sSX POST $TOKENS_URL -H "Content-Type: application/json" -d "{\"identity\": \"$USER_IDENTITY\",\"secret\": \"$USER_SECRET\"}" | jq -r .access_token)
export DOMAIN_ID=$(curl -sSX POST $CREATE_DOMAINS_URL -H "Content-Type: application/json" -H "Authorization: Bearer $USER_TOKEN" -d "{\"name\":\"$DOMAIN_NAME\",\"route\":\"$DOMAIN_NAME\"}" | jq -r .id)
echo "USER_TOKEN=$USER_TOKEN" >> $GITHUB_ENV
export CLIENT_SECRET=$(supermq-cli provision test | /usr/bin/grep -Eo '"secret": "[^"]+"' | awk 'NR % 2 == 0' | sed 's/"secret": "\(.*\)"/\1/')
export CLIENT_SECRET=$(magistrala-cli provision test | /usr/bin/grep -Eo '"secret": "[^"]+"' | awk 'NR % 2 == 0' | sed 's/"secret": "\(.*\)"/\1/')
echo "CLIENT_SECRET=$CLIENT_SECRET" >> $GITHUB_ENV
- name: Run Users API tests
+1 -1
View File
@@ -42,4 +42,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./swagger-ui
cname: docs.api.supermq.absmach.eu
cname: docs.api.magistrala.absmach.eu
+1 -1
View File
@@ -33,4 +33,4 @@ Pull request commit must be [signed](https://docs.github.com/en/github/authentic
## Adopters list (alphabetical)
**Note:** The list is maintained by the users themselves. If you find yourself on this list, and you think it's inappropriate. Please contact [project maintainers](https://github.com/absmach/supermq/blob/main/MAINTAINERS) and you will be permanently removed from the list.
**Note:** The list is maintained by the users themselves. If you find yourself on this list, and you think it's inappropriate. Please contact [project maintainers](https://github.com/absmach/magistrala/blob/main/MAINTAINERS) and you will be permanently removed from the list.
+4 -4
View File
@@ -13,7 +13,7 @@ Reporting issues are a great way to contribute to the project. We are perpetuall
thorough bug report.
Before raising a new issue, check [our issue
list](https://github.com/absmach/supermq/issues) to determine if it already contains the
list](https://github.com/absmach/magistrala/issues) to determine if it already contains the
problem that you are facing.
A good bug report shouldn't leave others needing to chase you for more information. Please be as detailed as possible. The following questions might serve as a template for writing a detailed
@@ -41,9 +41,9 @@ To contribute to the project, [fork](https://help.github.com/articles/fork-a-rep
clone your fork repository, and configure the remotes:
```
git clone https://github.com/<your-username>/supermq.git
cd supermq
git remote add upstream https://github.com/absmach/supermq.git
git clone https://github.com/<your-username>/magistrala.git
cd magistrala
git remote add upstream https://github.com/absmach/magistrala.git
```
If your cloned repository is behind the upstream commits, then get the latest changes from upstream:
+2 -2
View File
@@ -1,6 +1,6 @@
# SuperMQ Maintainers
# Magistrala Maintainers
SuperMQ follows a BDFL model for dead-lock situations; day-to-day decisions happen through discussion and pull requests.
Magistrala follows a BDFL model for dead-lock situations; day-to-day decisions happen through discussion and pull requests.
## BDFL
+3 -3
View File
@@ -47,9 +47,9 @@ BUILD_TAGS := $(strip $(MG_MESSAGE_BROKER_TYPE) $(MG_ES_TYPE))
define compile_service
CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) \
go build -tags "$(BUILD_TAGS)" -ldflags "-s -w \
-X 'github.com/absmach/supermq.BuildTime=$(TIME)' \
-X 'github.com/absmach/supermq.Version=$(VERSION)' \
-X 'github.com/absmach/supermq.Commit=$(COMMIT)'" \
-X 'github.com/absmach/magistrala.BuildTime=$(TIME)' \
-X 'github.com/absmach/magistrala.Version=$(VERSION)' \
-X 'github.com/absmach/magistrala.Commit=$(COMMIT)'" \
-o ${BUILD_DIR}/$(1) cmd/$(1)/main.go
endef
+26 -26
View File
@@ -1,31 +1,31 @@
<div align="center">
# SuperMQ
# Magistrala
### Planetary event-driven infrastructure
**Made with ❤️ by [Abstract Machines](https://absmach.eu/)**
[![Build Status](https://github.com/absmach/supermq/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/absmach/supermq/actions/workflows/build.yaml)
[![Go Report Card](https://goreportcard.com/badge/github.com/absmach/supermq)](https://goreportcard.com/report/github.com/absmach/supermq)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/absmach/supermq)
[![Check License Header](https://github.com/absmach/supermq/actions/workflows/check-license.yaml/badge.svg?branch=main)](https://github.com/absmach/supermq/actions/workflows/check-license.yaml)
[![Check Generated Files](https://github.com/absmach/supermq/actions/workflows/check-generated-files.yaml/badge.svg?branch=main)](https://github.com/absmach/supermq/actions/workflows/check-generated-files.yaml)
[![Coverage](https://codecov.io/gh/absmach/supermq/graph/badge.svg?token=nPCEr5nW8S)](https://codecov.io/gh/absmach/supermq)
[![Build Status](https://github.com/absmach/magistrala/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/absmach/magistrala/actions/workflows/build.yaml)
[![Go Report Card](https://goreportcard.com/badge/github.com/absmach/magistrala)](https://goreportcard.com/report/github.com/absmach/magistrala)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/absmach/magistrala)
[![Check License Header](https://github.com/absmach/magistrala/actions/workflows/check-license.yaml/badge.svg?branch=main)](https://github.com/absmach/magistrala/actions/workflows/check-license.yaml)
[![Check Generated Files](https://github.com/absmach/magistrala/actions/workflows/check-generated-files.yaml/badge.svg?branch=main)](https://github.com/absmach/magistrala/actions/workflows/check-generated-files.yaml)
[![Coverage](https://codecov.io/gh/absmach/magistrala/graph/badge.svg?token=nPCEr5nW8S)](https://codecov.io/gh/absmach/magistrala)
[![License](https://img.shields.io/badge/license-Apache%20v2.0-blue.svg)](LICENSE)
[![Matrix](https://img.shields.io/matrix/supermq%3Amatrix.org?label=Chat&style=flat&logo=matrix&logoColor=white)](https://matrix.to/#/#supermq:matrix.org)
### [Guide](https://docs.supermq.absmach.eu) | [Contributing](CONTRIBUTING.md) | [Website](https://absmach.eu/) | [Chat](https://matrix.to/#/#supermq:matrix.org)
### [Guide](https://magistrala.absmach.eu/docs/) | [Contributing](CONTRIBUTING.md) | [Website](https://absmach.eu/) | [Chat](https://matrix.to/#/#supermq:matrix.org)
</div>
## Introduction 📖
SuperMQ is a distributed, highly scalable, and secure open-source cloud platform for messaging and event-driven architecture (EDA). It is a planetarily distributed, highly scalable, and secure platform that serves as a robust foundation for building advanced real-time and reactive systems.
Magistrala is a distributed, highly scalable, and secure open-source cloud platform for messaging and event-driven architecture (EDA). It is a planetarily distributed, highly scalable, and secure platform that serves as a robust foundation for building advanced real-time and reactive systems.
## Why SuperMQ Stands Out 🚀
## Why Magistrala Stands Out 🚀
SuperMQ bridges the gap between various network protocols (HTTP, MQTT, WebSocket, CoAP, and more) to provide a seamless messaging experience. Whether you're working on IoT solutions, real-time data pipelines, or event-driven systems, SuperMQ has you covered. 🌐✨
Magistrala bridges the gap between various network protocols (HTTP, MQTT, WebSocket, CoAP, and more) to provide a seamless messaging experience. Whether you're working on IoT solutions, real-time data pipelines, or event-driven systems, Magistrala has you covered. 🌐✨
## Key Features 🌟
@@ -45,12 +45,12 @@ SuperMQ bridges the gap between various network protocols (HTTP, MQTT, WebSocket
## Installation 🛠️
There are multiple ways to run SuperMQ.
There are multiple ways to run Magistrala.
First, clone the repository and position to it:
```bash
git clone https://github.com/absmach/supermq.git
cd supermq
git clone https://github.com/absmach/magistrala.git
cd magistrala
```
To run the latest stable (tagged) version, use:
@@ -80,7 +80,7 @@ git checkout main
### Running on Apple Silicon (M1/M2/M3) Macs
When running SuperMQ on Apple Silicon Macs, the Makefile will automatically detect your ARM64 architecture and build Docker images locally.
When running Magistrala on Apple Silicon Macs, the Makefile will automatically detect your ARM64 architecture and build Docker images locally.
**If using Docker Desktop:**
@@ -92,7 +92,7 @@ When running SuperMQ on Apple Silicon Macs, the Makefile will automatically dete
After enabling these options, restart Docker Desktop, then run `make run_stable` or `make run_latest` as usual.
To manually run SuperMQ, clone the repository and start all core services:
To manually run Magistrala, clone the repository and start all core services:
```bash
docker compose -f docker/docker-compose.yaml --env-file docker/.env up
@@ -104,10 +104,10 @@ docker compose -f docker/docker-compose.yaml --env-file docker/.env up
```bash
make cli
./build/supermq-cli status
./build/magistrala-cli status
```
This command retrieves the status of the SuperMQ server and outputs it to the console.
This command retrieves the status of the Magistrala server and outputs it to the console.
**Using HTTP with Curl :**
@@ -117,20 +117,20 @@ curl -X GET http://localhost:8080/status
This request fetches the server status over HTTP and provides a JSON response.
See our [CLI documentation](https://docs.supermq.absmach.eu/cli) for more details.
See our [CLI documentation](https://magistrala.absmach.eu/docs/dev-guide/cli/introduction-to-cli/) for more details.
## Documentation 📚
The official documentation is hosted at [SuperMQ docs page](https://docs.supermq.absmach.eu/).
The official documentation is hosted at [Magistrala docs page](https://magistrala.absmach.eu/docs/).
Documentation is auto-generated, check out the instructions in the [docs repository](https://github.com/absmach/supermq-docs).
Documentation is auto-generated, check out the instructions in the [docs repository](https://github.com/absmach/magistrala-docs).
If you spot an error or a need for corrections, please let us know - or even better: send us a PR! 💌
## Community and Contributing 🤝
Thank you for your interest in SuperMQ and the desire to contribute!
Thank you for your interest in Magistrala and the desire to contribute!
1. Take a look at our [open issues](https://github.com/absmach/supermq/issues). The [good-first-issue](https://github.com/absmach/supermq/labels/good-first-issue) label is specifically for issues that are great for getting started.
1. Take a look at our [open issues](https://github.com/absmach/magistrala/issues). The [good-first-issue](https://github.com/absmach/magistrala/labels/good-first-issue) label is specifically for issues that are great for getting started.
2. Checkout the [contribution guide](CONTRIBUTING.md) to learn more about our style and conventions.
3. Make your changes compatible to our workflow.
@@ -140,14 +140,14 @@ Join our community:
## Professional Support 💼
Need help deploying SuperMQ or integrating it into your system? Reach out to **[Abstract Machines](https://absmach.eu/)** for professional support and guidance.
Need help deploying Magistrala or integrating it into your system? Reach out to **[Abstract Machines](https://absmach.eu/)** for professional support and guidance.
## License 📜
SuperMQ is open-source software licensed under the [Apache License 2.0](LICENSE). Contributions are welcome!
Magistrala is open-source software licensed under the [Apache License 2.0](LICENSE). Contributions are welcome!
## Acknowledgments 🙌
Special thanks to the amazing contributors who make SuperMQ possible. Check out the [MAINTAINERS](MAINTAINERS) file to see the team behind the magic.
Special thanks to the amazing contributors who make Magistrala possible. Check out the [MAINTAINERS](MAINTAINERS) file to see the team behind the magic.
Ready to build the future of messaging and event-driven systems? Let's get started! 🚀
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"errors"
"time"
"github.com/absmach/supermq/pkg/authn"
"github.com/absmach/magistrala/pkg/authn"
)
const SeverityMax uint8 = 100
+3 -3
View File
@@ -7,9 +7,9 @@ import (
"fmt"
"testing"
"github.com/absmach/supermq/alarms"
"github.com/absmach/supermq/internal/testsutil"
"github.com/absmach/supermq/pkg/errors"
"github.com/absmach/magistrala/alarms"
"github.com/absmach/magistrala/internal/testsutil"
"github.com/absmach/magistrala/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+5 -5
View File
@@ -6,11 +6,11 @@ package api
import (
"context"
"github.com/absmach/supermq/alarms"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/pkg/authn"
"github.com/absmach/supermq/pkg/errors"
svcerr "github.com/absmach/supermq/pkg/errors/service"
"github.com/absmach/magistrala/alarms"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/pkg/authn"
"github.com/absmach/magistrala/pkg/errors"
svcerr "github.com/absmach/magistrala/pkg/errors/service"
"github.com/go-kit/kit/endpoint"
)
+3 -3
View File
@@ -6,9 +6,9 @@ package api
import (
"errors"
"github.com/absmach/supermq/alarms"
api "github.com/absmach/supermq/api/http"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/magistrala/alarms"
api "github.com/absmach/magistrala/api/http"
apiutil "github.com/absmach/magistrala/api/http/util"
)
type alarmReq struct {
+4 -4
View File
@@ -7,13 +7,13 @@ import (
"fmt"
"net/http"
"github.com/absmach/supermq"
"github.com/absmach/supermq/alarms"
"github.com/absmach/magistrala"
"github.com/absmach/magistrala/alarms"
)
var (
_ supermq.Response = (*alarmRes)(nil)
_ supermq.Response = (*alarmsPageRes)(nil)
_ magistrala.Response = (*alarmRes)(nil)
_ magistrala.Response = (*alarmsPageRes)(nil)
)
type alarmRes struct {
+8 -8
View File
@@ -12,19 +12,19 @@ import (
"strings"
"time"
"github.com/absmach/supermq"
"github.com/absmach/supermq/alarms"
api "github.com/absmach/supermq/api/http"
apiutil "github.com/absmach/supermq/api/http/util"
smqauthn "github.com/absmach/supermq/pkg/authn"
"github.com/absmach/supermq/pkg/errors"
"github.com/absmach/magistrala"
"github.com/absmach/magistrala/alarms"
api "github.com/absmach/magistrala/api/http"
apiutil "github.com/absmach/magistrala/api/http/util"
smqauthn "github.com/absmach/magistrala/pkg/authn"
"github.com/absmach/magistrala/pkg/errors"
"github.com/go-chi/chi/v5"
kithttp "github.com/go-kit/kit/transport/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
)
func MakeHandler(svc alarms.Service, logger *slog.Logger, idp supermq.IDProvider, instanceID string, authn smqauthn.AuthNMiddleware) http.Handler {
func MakeHandler(svc alarms.Service, logger *slog.Logger, idp magistrala.IDProvider, instanceID string, authn smqauthn.AuthNMiddleware) http.Handler {
opts := []kithttp.ServerOption{
kithttp.ServerErrorEncoder(apiutil.LoggingErrorEncoder(logger, api.EncodeError)),
}
@@ -65,7 +65,7 @@ func MakeHandler(svc alarms.Service, logger *slog.Logger, idp supermq.IDProvider
})
})
mux.Get("/health", supermq.Health("alarms", instanceID))
mux.Get("/health", magistrala.Health("alarms", instanceID))
mux.Handle("/metrics", promhttp.Handler())
return mux
+3 -3
View File
@@ -11,8 +11,8 @@ import (
"log/slog"
"time"
"github.com/absmach/supermq/pkg/messaging"
broker "github.com/absmach/supermq/pkg/messaging/fluxmq"
"github.com/absmach/magistrala/pkg/messaging"
broker "github.com/absmach/magistrala/pkg/messaging/fluxmq"
"github.com/nats-io/nats.go/jetstream"
)
@@ -24,7 +24,7 @@ const (
var cfg = jetstream.StreamConfig{
Name: "alarms",
Description: "SuperMQ stream alarms",
Description: "Magistrala stream alarms",
Subjects: []string{"alarms/#"},
Retention: jetstream.LimitsPolicy,
MaxMsgsPerSubject: 1e6,
+3 -3
View File
@@ -11,8 +11,8 @@ import (
"log/slog"
"time"
"github.com/absmach/supermq/pkg/messaging"
broker "github.com/absmach/supermq/pkg/messaging/nats"
"github.com/absmach/magistrala/pkg/messaging"
broker "github.com/absmach/magistrala/pkg/messaging/nats"
"github.com/nats-io/nats.go/jetstream"
)
@@ -24,7 +24,7 @@ const (
var cfg = jetstream.StreamConfig{
Name: "alarms",
Description: "SuperMQ stream alarms",
Description: "Magistrala stream alarms",
Subjects: []string{"alarms.>"},
Retention: jetstream.LimitsPolicy,
MaxMsgsPerSubject: 1e6,
+3 -3
View File
@@ -10,9 +10,9 @@ import (
"log/slog"
"time"
"github.com/absmach/supermq/alarms"
"github.com/absmach/supermq/pkg/errors"
"github.com/absmach/supermq/pkg/messaging"
"github.com/absmach/magistrala/alarms"
"github.com/absmach/magistrala/pkg/errors"
"github.com/absmach/magistrala/pkg/messaging"
)
var errFailedToDecode = errors.New("failed to decode alarm")
+9 -9
View File
@@ -6,15 +6,15 @@ package middleware
import (
"context"
"github.com/absmach/supermq/alarms"
"github.com/absmach/supermq/alarms/operations"
"github.com/absmach/supermq/auth"
"github.com/absmach/supermq/pkg/authn"
smqauthz "github.com/absmach/supermq/pkg/authz"
"github.com/absmach/supermq/pkg/errors"
svcerr "github.com/absmach/supermq/pkg/errors/service"
"github.com/absmach/supermq/pkg/permissions"
"github.com/absmach/supermq/pkg/policies"
"github.com/absmach/magistrala/alarms"
"github.com/absmach/magistrala/alarms/operations"
"github.com/absmach/magistrala/auth"
"github.com/absmach/magistrala/pkg/authn"
smqauthz "github.com/absmach/magistrala/pkg/authz"
"github.com/absmach/magistrala/pkg/errors"
svcerr "github.com/absmach/magistrala/pkg/errors/service"
"github.com/absmach/magistrala/pkg/permissions"
"github.com/absmach/magistrala/pkg/policies"
)
var (
+2 -2
View File
@@ -8,8 +8,8 @@ import (
"log/slog"
"time"
"github.com/absmach/supermq/alarms"
"github.com/absmach/supermq/pkg/authn"
"github.com/absmach/magistrala/alarms"
"github.com/absmach/magistrala/pkg/authn"
"github.com/go-chi/chi/v5/middleware"
)
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"context"
"time"
"github.com/absmach/supermq/alarms"
"github.com/absmach/supermq/pkg/authn"
"github.com/absmach/magistrala/alarms"
"github.com/absmach/magistrala/pkg/authn"
"github.com/go-kit/kit/metrics"
)
+3 -3
View File
@@ -6,9 +6,9 @@ package middleware
import (
"context"
"github.com/absmach/supermq/alarms"
"github.com/absmach/supermq/pkg/authn"
smqTracing "github.com/absmach/supermq/pkg/tracing"
"github.com/absmach/magistrala/alarms"
"github.com/absmach/magistrala/pkg/authn"
smqTracing "github.com/absmach/magistrala/pkg/tracing"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
)
+1 -1
View File
@@ -11,7 +11,7 @@ package mocks
import (
"context"
"github.com/absmach/supermq/alarms"
"github.com/absmach/magistrala/alarms"
mock "github.com/stretchr/testify/mock"
)
+2 -2
View File
@@ -11,8 +11,8 @@ package mocks
import (
"context"
"github.com/absmach/supermq/alarms"
"github.com/absmach/supermq/pkg/authn"
"github.com/absmach/magistrala/alarms"
"github.com/absmach/magistrala/pkg/authn"
mock "github.com/stretchr/testify/mock"
)
+1 -1
View File
@@ -3,7 +3,7 @@
package operations
import "github.com/absmach/supermq/pkg/permissions"
import "github.com/absmach/magistrala/pkg/permissions"
const EntityType = "alarm"
+5 -5
View File
@@ -12,11 +12,11 @@ import (
"strings"
"time"
"github.com/absmach/supermq/alarms"
api "github.com/absmach/supermq/api/http"
"github.com/absmach/supermq/pkg/errors"
repoerr "github.com/absmach/supermq/pkg/errors/repository"
"github.com/absmach/supermq/pkg/postgres"
"github.com/absmach/magistrala/alarms"
api "github.com/absmach/magistrala/api/http"
"github.com/absmach/magistrala/pkg/errors"
repoerr "github.com/absmach/magistrala/pkg/errors/repository"
"github.com/absmach/magistrala/pkg/postgres"
"github.com/jmoiron/sqlx"
)
+5 -5
View File
@@ -11,11 +11,11 @@ import (
"time"
"github.com/0x6flab/namegenerator"
"github.com/absmach/supermq/alarms"
"github.com/absmach/supermq/alarms/postgres"
"github.com/absmach/supermq/pkg/errors"
repoerr "github.com/absmach/supermq/pkg/errors/repository"
"github.com/absmach/supermq/pkg/uuid"
"github.com/absmach/magistrala/alarms"
"github.com/absmach/magistrala/alarms/postgres"
"github.com/absmach/magistrala/pkg/errors"
repoerr "github.com/absmach/magistrala/pkg/errors/repository"
"github.com/absmach/magistrala/pkg/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -4,9 +4,9 @@
package postgres
import (
"github.com/absmach/supermq/pkg/errors"
repoerr "github.com/absmach/supermq/pkg/errors/repository"
rpostgres "github.com/absmach/supermq/re/postgres"
"github.com/absmach/magistrala/pkg/errors"
repoerr "github.com/absmach/magistrala/pkg/errors/repository"
rpostgres "github.com/absmach/magistrala/re/postgres"
_ "github.com/jackc/pgx/v5/stdlib" // required for SQL access
migrate "github.com/rubenv/sql-migrate"
)
+2 -2
View File
@@ -11,8 +11,8 @@ import (
"testing"
"time"
apostgres "github.com/absmach/supermq/alarms/postgres"
"github.com/absmach/supermq/pkg/postgres"
apostgres "github.com/absmach/magistrala/alarms/postgres"
"github.com/absmach/magistrala/pkg/postgres"
"github.com/jmoiron/sqlx"
dockertest "github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
+5 -5
View File
@@ -7,19 +7,19 @@ import (
"context"
"time"
"github.com/absmach/supermq"
"github.com/absmach/supermq/pkg/authn"
repoerr "github.com/absmach/supermq/pkg/errors/repository"
"github.com/absmach/magistrala"
"github.com/absmach/magistrala/pkg/authn"
repoerr "github.com/absmach/magistrala/pkg/errors/repository"
)
type service struct {
idp supermq.IDProvider
idp magistrala.IDProvider
repo Repository
}
var _ Service = (*service)(nil)
func NewService(idp supermq.IDProvider, repo Repository) Service {
func NewService(idp magistrala.IDProvider, repo Repository) Service {
return &service{
idp: idp,
repo: repo,
+6 -6
View File
@@ -9,12 +9,12 @@ import (
"testing"
"time"
"github.com/absmach/supermq/alarms"
"github.com/absmach/supermq/alarms/mocks"
"github.com/absmach/supermq/pkg/authn"
"github.com/absmach/supermq/pkg/errors"
repoerr "github.com/absmach/supermq/pkg/errors/repository"
"github.com/absmach/supermq/pkg/uuid"
"github.com/absmach/magistrala/alarms"
"github.com/absmach/magistrala/alarms/mocks"
"github.com/absmach/magistrala/pkg/authn"
"github.com/absmach/magistrala/pkg/errors"
repoerr "github.com/absmach/magistrala/pkg/errors/repository"
"github.com/absmach/magistrala/pkg/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"encoding/json"
"strings"
svcerr "github.com/absmach/supermq/pkg/errors/service"
svcerr "github.com/absmach/magistrala/pkg/errors/service"
)
type Status uint8
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
package supermq
package magistrala
// Response contains HTTP response specific methods.
type Response interface {
+1 -1
View File
@@ -478,7 +478,7 @@ const file_auth_v1_auth_proto_rawDesc = "" +
"\x02id\x18\x02 \x01(\tR\x02id2z\n" +
"\vAuthService\x123\n" +
"\tAuthorize\x12\x11.auth.v1.AuthZReq\x1a\x11.auth.v1.AuthZRes\"\x00\x126\n" +
"\fAuthenticate\x12\x11.auth.v1.AuthNReq\x1a\x11.auth.v1.AuthNRes\"\x00B-Z+github.com/absmach/supermq/api/grpc/auth/v1b\x06proto3"
"\fAuthenticate\x12\x11.auth.v1.AuthNReq\x1a\x11.auth.v1.AuthNRes\"\x00B0Z.github.com/absmach/magistrala/api/grpc/auth/v1b\x06proto3"
var (
file_auth_v1_auth_proto_rawDescOnce sync.Once
+2 -2
View File
@@ -31,7 +31,7 @@ const (
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// AuthService is a service that provides authentication
// and authorization functionalities for SuperMQ services.
// and authorization functionalities for Magistrala services.
type AuthServiceClient interface {
Authorize(ctx context.Context, in *AuthZReq, opts ...grpc.CallOption) (*AuthZRes, error)
Authenticate(ctx context.Context, in *AuthNReq, opts ...grpc.CallOption) (*AuthNRes, error)
@@ -70,7 +70,7 @@ func (c *authServiceClient) Authenticate(ctx context.Context, in *AuthNReq, opts
// for forward compatibility.
//
// AuthService is a service that provides authentication
// and authorization functionalities for SuperMQ services.
// and authorization functionalities for Magistrala services.
type AuthServiceServer interface {
Authorize(context.Context, *AuthZReq) (*AuthZRes, error)
Authenticate(context.Context, *AuthNReq) (*AuthNRes, error)
+1 -1
View File
@@ -170,7 +170,7 @@ const file_certs_v1_certs_proto_rawDesc = "" +
"\tentity_id\x18\x01 \x01(\tR\bentityId2\x96\x01\n" +
"\fCertsService\x12C\n" +
"\vGetEntityID\x12\x18.absmach.certs.EntityReq\x1a\x18.absmach.certs.EntityRes\"\x00\x12A\n" +
"\vRevokeCerts\x12\x18.absmach.certs.RevokeReq\x1a\x16.google.protobuf.Empty\"\x00B.Z,github.com/absmach/supermq/api/grpc/certs/v1b\x06proto3"
"\vRevokeCerts\x12\x18.absmach.certs.RevokeReq\x1a\x16.google.protobuf.Empty\"\x00B1Z/github.com/absmach/magistrala/api/grpc/certs/v1b\x06proto3"
var (
file_certs_v1_certs_proto_rawDescOnce sync.Once
+2 -2
View File
@@ -10,7 +10,7 @@
package v1
import (
v1 "github.com/absmach/supermq/api/grpc/common/v1"
v1 "github.com/absmach/magistrala/api/grpc/common/v1"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -333,7 +333,7 @@ const file_channels_v1_channels_proto_rawDesc = "" +
"\x17RemoveClientConnections\x12'.channels.v1.RemoveClientConnectionsReq\x1a'.channels.v1.RemoveClientConnectionsRes\"\x00\x12|\n" +
"\x1cUnsetParentGroupFromChannels\x12,.channels.v1.UnsetParentGroupFromChannelsReq\x1a,.channels.v1.UnsetParentGroupFromChannelsRes\"\x00\x12N\n" +
"\x0eRetrieveEntity\x12\x1c.common.v1.RetrieveEntityReq\x1a\x1c.common.v1.RetrieveEntityRes\"\x00\x12T\n" +
"\x11RetrieveIDByRoute\x12\x1f.common.v1.RetrieveIDByRouteReq\x1a\x1c.common.v1.RetrieveEntityRes\"\x00B1Z/github.com/absmach/supermq/api/grpc/channels/v1b\x06proto3"
"\x11RetrieveIDByRoute\x12\x1f.common.v1.RetrieveIDByRouteReq\x1a\x1c.common.v1.RetrieveEntityRes\"\x00B4Z2github.com/absmach/magistrala/api/grpc/channels/v1b\x06proto3"
var (
file_channels_v1_channels_proto_rawDescOnce sync.Once
+1 -1
View File
@@ -11,7 +11,7 @@ package v1
import (
context "context"
v1 "github.com/absmach/supermq/api/grpc/common/v1"
v1 "github.com/absmach/magistrala/api/grpc/common/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
+2 -2
View File
@@ -10,7 +10,7 @@
package v1
import (
v1 "github.com/absmach/supermq/api/grpc/common/v1"
v1 "github.com/absmach/magistrala/api/grpc/common/v1"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -306,7 +306,7 @@ const file_clients_v1_clients_proto_rawDesc = "" +
"\x0eAddConnections\x12\x1c.common.v1.AddConnectionsReq\x1a\x1c.common.v1.AddConnectionsRes\"\x00\x12W\n" +
"\x11RemoveConnections\x12\x1f.common.v1.RemoveConnectionsReq\x1a\x1f.common.v1.RemoveConnectionsRes\"\x00\x12n\n" +
"\x18RemoveChannelConnections\x12'.clients.v1.RemoveChannelConnectionsReq\x1a'.clients.v1.RemoveChannelConnectionsRes\"\x00\x12t\n" +
"\x1aUnsetParentGroupFromClient\x12).clients.v1.UnsetParentGroupFromClientReq\x1a).clients.v1.UnsetParentGroupFromClientRes\"\x00B0Z.github.com/absmach/supermq/api/grpc/clients/v1b\x06proto3"
"\x1aUnsetParentGroupFromClient\x12).clients.v1.UnsetParentGroupFromClientReq\x1a).clients.v1.UnsetParentGroupFromClientRes\"\x00B3Z1github.com/absmach/magistrala/api/grpc/clients/v1b\x06proto3"
var (
file_clients_v1_clients_proto_rawDescOnce sync.Once
+3 -3
View File
@@ -11,7 +11,7 @@ package v1
import (
context "context"
v1 "github.com/absmach/supermq/api/grpc/common/v1"
v1 "github.com/absmach/magistrala/api/grpc/common/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -37,7 +37,7 @@ const (
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// ClientsService is a service that provides clients
// authorization functionalities for SuperMQ services.
// authorization functionalities for Magistrala services.
type ClientsServiceClient interface {
// Authorize checks if the client is authorized to perform
Authenticate(ctx context.Context, in *AuthnReq, opts ...grpc.CallOption) (*AuthnRes, error)
@@ -132,7 +132,7 @@ func (c *clientsServiceClient) UnsetParentGroupFromClient(ctx context.Context, i
// for forward compatibility.
//
// ClientsService is a service that provides clients
// authorization functionalities for SuperMQ services.
// authorization functionalities for Magistrala services.
type ClientsServiceServer interface {
// Authorize checks if the client is authorized to perform
Authenticate(context.Context, *AuthnReq) (*AuthnRes, error)
+1 -1
View File
@@ -626,7 +626,7 @@ const file_common_v1_common_proto_rawDesc = "" +
"\x04type\x18\x04 \x01(\rR\x04type\"I\n" +
"\x14RetrieveIDByRouteReq\x12\x14\n" +
"\x05route\x18\x01 \x01(\tR\x05route\x12\x1b\n" +
"\tdomain_id\x18\x02 \x01(\tR\bdomainIdB/Z-github.com/absmach/supermq/api/grpc/common/v1b\x06proto3"
"\tdomain_id\x18\x02 \x01(\tR\bdomainIdB2Z0github.com/absmach/magistrala/api/grpc/common/v1b\x06proto3"
var (
file_common_v1_common_proto_rawDescOnce sync.Once
+2 -2
View File
@@ -10,7 +10,7 @@
package v1
import (
v1 "github.com/absmach/supermq/api/grpc/common/v1"
v1 "github.com/absmach/magistrala/api/grpc/common/v1"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -126,7 +126,7 @@ const file_domains_v1_domains_proto_rawDesc = "" +
"\x0eDomainsService\x12O\n" +
"\x15DeleteUserFromDomains\x12\x19.domains.v1.DeleteUserReq\x1a\x19.domains.v1.DeleteUserRes\"\x00\x12N\n" +
"\x0eRetrieveStatus\x12\x1c.common.v1.RetrieveEntityReq\x1a\x1c.common.v1.RetrieveEntityRes\"\x00\x12T\n" +
"\x11RetrieveIDByRoute\x12\x1f.common.v1.RetrieveIDByRouteReq\x1a\x1c.common.v1.RetrieveEntityRes\"\x00B5Z3github.com/absmach/supermq/internal/grpc/domains/v1b\x06proto3"
"\x11RetrieveIDByRoute\x12\x1f.common.v1.RetrieveIDByRouteReq\x1a\x1c.common.v1.RetrieveEntityRes\"\x00B8Z6github.com/absmach/magistrala/internal/grpc/domains/v1b\x06proto3"
var (
file_domains_v1_domains_proto_rawDescOnce sync.Once
+3 -3
View File
@@ -11,7 +11,7 @@ package v1
import (
context "context"
v1 "github.com/absmach/supermq/api/grpc/common/v1"
v1 "github.com/absmach/magistrala/api/grpc/common/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -33,7 +33,7 @@ const (
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// DomainsService is a service that provides access to
// domains functionalities for SuperMQ services.
// domains functionalities for Magistrala services.
type DomainsServiceClient interface {
DeleteUserFromDomains(ctx context.Context, in *DeleteUserReq, opts ...grpc.CallOption) (*DeleteUserRes, error)
RetrieveStatus(ctx context.Context, in *v1.RetrieveEntityReq, opts ...grpc.CallOption) (*v1.RetrieveEntityRes, error)
@@ -83,7 +83,7 @@ func (c *domainsServiceClient) RetrieveIDByRoute(ctx context.Context, in *v1.Ret
// for forward compatibility.
//
// DomainsService is a service that provides access to
// domains functionalities for SuperMQ services.
// domains functionalities for Magistrala services.
type DomainsServiceServer interface {
DeleteUserFromDomains(context.Context, *DeleteUserReq) (*DeleteUserRes, error)
RetrieveStatus(context.Context, *v1.RetrieveEntityReq) (*v1.RetrieveEntityRes, error)
+2 -2
View File
@@ -10,7 +10,7 @@
package v1
import (
v1 "github.com/absmach/supermq/api/grpc/common/v1"
v1 "github.com/absmach/magistrala/api/grpc/common/v1"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -30,7 +30,7 @@ const file_groups_v1_groups_proto_rawDesc = "" +
"\n" +
"\x16groups/v1/groups.proto\x12\tgroups.v1\x1a\x16common/v1/common.proto2_\n" +
"\rGroupsService\x12N\n" +
"\x0eRetrieveEntity\x12\x1c.common.v1.RetrieveEntityReq\x1a\x1c.common.v1.RetrieveEntityRes\"\x00B/Z-github.com/absmach/supermq/api/grpc/groups/v1b\x06proto3"
"\x0eRetrieveEntity\x12\x1c.common.v1.RetrieveEntityReq\x1a\x1c.common.v1.RetrieveEntityRes\"\x00B2Z0github.com/absmach/magistrala/api/grpc/groups/v1b\x06proto3"
var file_groups_v1_groups_proto_goTypes = []any{
(*v1.RetrieveEntityReq)(nil), // 0: common.v1.RetrieveEntityReq
+3 -3
View File
@@ -11,7 +11,7 @@ package v1
import (
context "context"
v1 "github.com/absmach/supermq/api/grpc/common/v1"
v1 "github.com/absmach/magistrala/api/grpc/common/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -31,7 +31,7 @@ const (
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// GroupssService is a service that provides groups
// functionalities for SuperMQ services.
// functionalities for Magistrala services.
type GroupsServiceClient interface {
RetrieveEntity(ctx context.Context, in *v1.RetrieveEntityReq, opts ...grpc.CallOption) (*v1.RetrieveEntityRes, error)
}
@@ -59,7 +59,7 @@ func (c *groupsServiceClient) RetrieveEntity(ctx context.Context, in *v1.Retriev
// for forward compatibility.
//
// GroupssService is a service that provides groups
// functionalities for SuperMQ services.
// functionalities for Magistrala services.
type GroupsServiceServer interface {
RetrieveEntity(context.Context, *v1.RetrieveEntityReq) (*v1.RetrieveEntityRes, error)
mustEmbedUnimplementedGroupsServiceServer()
+1 -1
View File
@@ -798,7 +798,7 @@ const file_readers_v1_readers_proto_rawDesc = "" +
"\x11AGGREGATION_COUNT\x10\x04\x12\x13\n" +
"\x0fAGGREGATION_AVG\x10\x052\\\n" +
"\x0eReadersService\x12J\n" +
"\fReadMessages\x12\x1b.readers.v1.ReadMessagesReq\x1a\x1b.readers.v1.ReadMessagesRes\"\x00B0Z.github.com/absmach/supermq/api/grpc/readers/v1b\x06proto3"
"\fReadMessages\x12\x1b.readers.v1.ReadMessagesReq\x1a\x1b.readers.v1.ReadMessagesRes\"\x00B3Z1github.com/absmach/magistrala/api/grpc/readers/v1b\x06proto3"
var (
file_readers_v1_readers_proto_rawDescOnce sync.Once
+2 -2
View File
@@ -30,7 +30,7 @@ const (
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// ReadersService is a service that provides access to
// readers functionalities for SuperMQ services.
// readers functionalities for Magistrala services.
type ReadersServiceClient interface {
ReadMessages(ctx context.Context, in *ReadMessagesReq, opts ...grpc.CallOption) (*ReadMessagesRes, error)
}
@@ -58,7 +58,7 @@ func (c *readersServiceClient) ReadMessages(ctx context.Context, in *ReadMessage
// for forward compatibility.
//
// ReadersService is a service that provides access to
// readers functionalities for SuperMQ services.
// readers functionalities for Magistrala services.
type ReadersServiceServer interface {
ReadMessages(context.Context, *ReadMessagesReq) (*ReadMessagesRes, error)
mustEmbedUnimplementedReadersServiceServer()
+1 -1
View File
@@ -479,7 +479,7 @@ const file_token_v1_token_proto_rawDesc = "" +
"\x05Issue\x12\x12.token.v1.IssueReq\x1a\x0f.token.v1.Token\"\x00\x122\n" +
"\aRefresh\x12\x14.token.v1.RefreshReq\x1a\x0f.token.v1.Token\"\x00\x124\n" +
"\x06Revoke\x12\x13.token.v1.RevokeReq\x1a\x13.token.v1.RevokeRes\"\x00\x12a\n" +
"\x15ListUserRefreshTokens\x12\".token.v1.ListUserRefreshTokensReq\x1a\".token.v1.ListUserRefreshTokensRes\"\x00B.Z,github.com/absmach/supermq/api/grpc/token/v1b\x06proto3"
"\x15ListUserRefreshTokens\x12\".token.v1.ListUserRefreshTokensReq\x1a\".token.v1.ListUserRefreshTokensRes\"\x00B1Z/github.com/absmach/magistrala/api/grpc/token/v1b\x06proto3"
var (
file_token_v1_token_proto_rawDescOnce sync.Once
+1 -1
View File
@@ -365,7 +365,7 @@ const file_users_v1_users_proto_rawDesc = "" +
"\rauth_provider\x18\x10 \x01(\tR\fauthProvider\x12 \n" +
"\vpermissions\x18\x11 \x03(\tR\vpermissions2Y\n" +
"\fUsersService\x12I\n" +
"\rRetrieveUsers\x12\x1a.users.v1.RetrieveUsersReq\x1a\x1a.users.v1.RetrieveUsersRes\"\x00B.Z,github.com/absmach/supermq/api/grpc/users/v1b\x06proto3"
"\rRetrieveUsers\x12\x1a.users.v1.RetrieveUsersReq\x1a\x1a.users.v1.RetrieveUsersRes\"\x00B1Z/github.com/absmach/magistrala/api/grpc/users/v1b\x06proto3"
var (
file_users_v1_users_proto_rawDescOnce sync.Once
+7 -7
View File
@@ -11,12 +11,12 @@ import (
"regexp"
"strings"
"github.com/absmach/supermq"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/clients"
"github.com/absmach/supermq/groups"
"github.com/absmach/supermq/pkg/errors"
"github.com/absmach/supermq/users"
"github.com/absmach/magistrala"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/clients"
"github.com/absmach/magistrala/groups"
"github.com/absmach/magistrala/pkg/errors"
"github.com/absmach/magistrala/users"
"github.com/gofrs/uuid/v5"
)
@@ -158,7 +158,7 @@ func ValidateUserName(name string) error {
// EncodeResponse encodes successful response.
func EncodeResponse(_ context.Context, w http.ResponseWriter, response any) error {
if ar, ok := response.(supermq.Response); ok {
if ar, ok := response.(magistrala.Response); ok {
for k, v := range ar.Headers() {
w.Header().Set(k, v)
}
+7 -7
View File
@@ -10,16 +10,16 @@ import (
"testing"
"time"
"github.com/absmach/supermq"
api "github.com/absmach/supermq/api/http"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/internal/testsutil"
"github.com/absmach/supermq/pkg/errors"
svcerr "github.com/absmach/supermq/pkg/errors/service"
"github.com/absmach/magistrala"
api "github.com/absmach/magistrala/api/http"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/internal/testsutil"
"github.com/absmach/magistrala/pkg/errors"
svcerr "github.com/absmach/magistrala/pkg/errors/service"
"github.com/stretchr/testify/assert"
)
var _ supermq.Response = (*response)(nil)
var _ magistrala.Response = (*response)(nil)
var validUUID = testsutil.GenerateUUID(&testing.T{})
+2 -2
View File
@@ -7,11 +7,11 @@ import (
"context"
"net/http"
"github.com/absmach/supermq"
"github.com/absmach/magistrala"
"github.com/go-chi/chi/v5/middleware"
)
func RequestIDMiddleware(idp supermq.IDProvider) func(http.Handler) http.Handler {
func RequestIDMiddleware(idp magistrala.IDProvider) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
requestID, err := idp.ID()
+1 -1
View File
@@ -3,7 +3,7 @@
package util
import "github.com/absmach/supermq/pkg/errors"
import "github.com/absmach/magistrala/pkg/errors"
// Errors defined in this file are used by the LoggingErrorEncoder decorator
// to distinguish and log API request validation errors and avoid that service
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"net/http"
"testing"
apiutil "github.com/absmach/supermq/api/http/util"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/stretchr/testify/assert"
)
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"net/http"
"strconv"
"github.com/absmach/supermq/pkg/errors"
"github.com/absmach/magistrala/pkg/errors"
kithttp "github.com/go-kit/kit/transport/http"
)
+5 -5
View File
@@ -11,10 +11,10 @@ import (
"net/url"
"testing"
apiutil "github.com/absmach/supermq/api/http/util"
smqlog "github.com/absmach/supermq/logger"
"github.com/absmach/supermq/pkg/errors"
svcerr "github.com/absmach/supermq/pkg/errors/service"
apiutil "github.com/absmach/magistrala/api/http/util"
mglog "github.com/absmach/magistrala/logger"
"github.com/absmach/magistrala/pkg/errors"
svcerr "github.com/absmach/magistrala/pkg/errors/service"
"github.com/stretchr/testify/assert"
)
@@ -355,7 +355,7 @@ func TestLoggingErrorEncoder(t *testing.T) {
encCalled = true
}
errorEncoder := apiutil.LoggingErrorEncoder(smqlog.NewMock(), encFunc)
errorEncoder := apiutil.LoggingErrorEncoder(mglog.NewMock(), encFunc)
errorEncoder(context.Background(), c.err, httptest.NewRecorder())
assert.True(t, encCalled)
+5 -5
View File
@@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0
asyncapi: '2.6.0'
id: 'https://github.com/absmach/supermq/blob/main/api/asyncapi/mqtt.yaml'
id: 'https://github.com/absmach/magistrala/blob/main/api/asyncapi/mqtt.yaml'
info:
title: SuperMQ MQTT Adapter
title: Magistrala MQTT Adapter
version: '0.18.0'
contact:
name: SuperMQ Team
url: 'https://github.com/absmach/supermq'
name: Magistrala Team
url: 'https://github.com/absmach/magistrala'
email: info@absmach.eu
description: |
MQTT adapter provides an MQTT API for sending messages through the platform. MQTT adapter uses [mProxy](https://github.com/absmach/mproxy) for proxying traffic between client and MQTT broker.
@@ -16,7 +16,7 @@ info:
license:
name: Apache 2.0
url: 'https://github.com/absmach/supermq/blob/main/LICENSE'
url: 'https://github.com/absmach/magistrala/blob/main/LICENSE'
defaultContentType: application/json
+7 -7
View File
@@ -2,18 +2,18 @@
# SPDX-License-Identifier: Apache-2.0
asyncapi: 2.6.0
id: 'https://github.com/absmach/supermq/blob/main/api/asyncapi/websocket.yaml'
id: 'https://github.com/absmach/magistrala/blob/main/api/asyncapi/websocket.yaml'
info:
title: SuperMQ WebSocket adapter
title: Magistrala WebSocket adapter
description: WebSocket adapter provides a WebSocket API for sending messages through communication channels. WebSocket adapter uses [mProxy](https://github.com/absmach/mproxy) for proxying traffic between client and MQTT broker.
version: '0.18.0'
contact:
name: SuperMQ Team
url: 'https://github.com/absmach/supermq'
name: Magistrala Team
url: 'https://github.com/absmach/magistrala'
email: info@absmach.eu
license:
name: Apache 2.0
url: 'https://github.com/absmach/supermq/blob/main/LICENSE'
url: 'https://github.com/absmach/magistrala/blob/main/LICENSE'
tags:
- name: WebSocket
defaultContentType: application/json
@@ -28,7 +28,7 @@ servers:
description: Hostname of the WebSocket adapter
default: localhost
port:
description: SuperMQ WebSocket Adapter port
description: Magistrala WebSocket Adapter port
default: '8008'
channels:
@@ -74,7 +74,7 @@ channels:
- bearerAuth: []
/version:
subscribe:
summary: Get the version of the SuperMQ adapter
summary: Get the version of the Magistrala adapter
operationId: getVersion
bindings:
http:
+3 -3
View File
@@ -1,5 +1,5 @@
# SuperMQ OpenAPI Specification
# Magistrala OpenAPI Specification
This folder contains an OpenAPI specifications for SuperMQ API.
This folder contains an OpenAPI specifications for Magistrala API.
View specification in Swagger UI at [docs.api.supermq.absmach.eu](https://docs.api.supermq.absmach.eu)
View specification in Swagger UI at [docs.api.magistrala.absmach.eu](https://docs.api.magistrala.absmach.eu)
+3 -3
View File
@@ -7,12 +7,12 @@ info:
description: |
HTTP API for managing alarms service.
Some useful links:
- [The Magistrala repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.5
servers:
@@ -24,7 +24,7 @@ tags:
description: Everything about your Alarms
externalDocs:
description: Find out more about alarms
url: https://docs.magistrala.absmach.eu
url: https://magistrala.absmach.eu/docs/
paths:
/{domainID}/alarms:
+6 -6
View File
@@ -3,16 +3,16 @@
openapi: 3.0.3
info:
title: SuperMQ Auth Service
title: Magistrala Auth Service
description: |
This is the Auth Server based on the OpenAPI 3.0 specification. It is the HTTP API for managing platform users. You can now help us improve the API whether it's by making changes to the definition itself or to the code.
Some useful links:
- [The SuperMQ repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.0
servers:
@@ -24,17 +24,17 @@ tags:
description: Everything about your Keys.
externalDocs:
description: Find out more about keys
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: PATs
description: Everything about your Personal Access Tokens.
externalDocs:
description: Find out more about Personal Access Tokens
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Health
description: Service health check endpoint.
externalDocs:
description: Find out more about health check
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
paths:
/keys:
+12 -12
View File
@@ -7,12 +7,12 @@ info:
description: |
HTTP API for managing platform clients configuration.
Some useful links:
- [The Magistrala repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.5
servers:
@@ -24,7 +24,7 @@ tags:
description: Everything about your Configs
externalDocs:
description: Find out more about Configs
url: https://docs.magistrala.absmach.eu
url: https://magistrala.absmach.eu/docs/
paths:
/{domainID}/clients/configs:
@@ -119,7 +119,7 @@ paths:
description: |
Update is performed by replacing the current resource data with values
provided in a request payload. Note that the owner, ID, external ID,
external key, SuperMQ Client ID and key cannot be changed.
external key, Magistrala Client ID and key cannot be changed.
tags:
- configs
parameters:
@@ -149,7 +149,7 @@ paths:
summary: Removes a Config
description: |
Removes a Config. In case of successful removal the service will ensure
that the removed config is disconnected from all of the SuperMQ channels.
that the removed config is disconnected from all of the Magistrala channels.
tags:
- configs
parameters:
@@ -293,7 +293,7 @@ paths:
summary: Updates Config state.
description: |
Updating state represents enabling/disabling Config, i.e. connecting
and disconnecting corresponding SuperMQ Client to the list of Channels.
and disconnecting corresponding Magistrala Client to the list of Channels.
tags:
- configs
parameters:
@@ -340,11 +340,11 @@ components:
client_id:
type: string
format: uuid
description: Corresponding SuperMQ Client ID.
description: Corresponding Magistrala Client ID.
magistrala_secret:
type: string
format: uuid
description: Corresponding SuperMQ Client key.
description: Corresponding Magistrala Client key.
channels:
type: array
minItems: 0
@@ -412,11 +412,11 @@ components:
client_id:
type: string
format: uuid
description: Corresponding SuperMQ Client ID.
description: Corresponding Magistrala Client ID.
client_key:
type: string
format: uuid
description: Corresponding SuperMQ Client key.
description: Corresponding Magistrala Client key.
channels:
type: array
minItems: 0
@@ -439,7 +439,7 @@ components:
client_id:
type: string
format: uuid
description: Corresponding SuperMQ Client ID.
description: Corresponding Magistrala Client ID.
client_cert:
type: string
description: Client certificate.
@@ -532,7 +532,7 @@ components:
client_id:
type: string
format: uuid
description: ID of the corresponding SuperMQ Client.
description: ID of the corresponding Magistrala Client.
channels:
type: array
minItems: 0
+6 -6
View File
@@ -3,16 +3,16 @@
openapi: 3.0.3
info:
title: SuperMQ Channels Service
title: Magistrala Channels Service
description: |
This is the Channels Server based on the OpenAPI 3.0 specification. It is the HTTP API for managing platform channels. You can now help us improve the API whether it's by making changes to the definition itself or to the code.
Some useful links:
- [The SuperMQ repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.0
servers:
@@ -24,17 +24,17 @@ tags:
description: CRUD operations for your channels
externalDocs:
description: Find out more about channels
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Connections
description: All operations involving channel and client connections
externalDocs:
description: Find out more about channel and client connections
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Health
description: Health check operations
externalDocs:
description: Find out more about health checks
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
paths:
/{domainID}/channels:
+6 -6
View File
@@ -3,16 +3,16 @@
openapi: 3.0.3
info:
title: SuperMQ Clients Service
title: Magistrala Clients Service
description: |
This is the Clients Server based on the OpenAPI 3.0 specification. It is the HTTP API for managing platform clients. You can now help us improve the API whether it's by making changes to the definition itself or to the code.
Some useful links:
- [The SuperMQ repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.0
servers:
@@ -24,17 +24,17 @@ tags:
description: CRUD operations for your clients
externalDocs:
description: Find out more about clients
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Roles
description: All operations involving roles for clients
externalDocs:
description: Find out more about roles
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Health
description: Health check operations
externalDocs:
description: Find out more about health checks
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
paths:
/{domainID}/clients:
+7 -7
View File
@@ -3,16 +3,16 @@
openapi: 3.0.3
info:
title: SuperMQ Domains Service
title: Magistrala Domains Service
description: |
This is the Domains Server based on the OpenAPI 3.0 specification. It is the HTTP API for managing platform domains. You can now help us improve the API whether it's by making changes to the definition itself or to the code.
Some useful links:
- [The SuperMQ repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.0
servers:
@@ -24,22 +24,22 @@ tags:
description: CRUD operations for your domains
externalDocs:
description: Find out more about domains
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Roles
description: All operations involving roles for domains
externalDocs:
description: Find out more about roles
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Invitations
description: All operations involving invitations for domains
externalDocs:
description: Find out more about Invitations
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Health
description: Service health check endpoint.
externalDocs:
description: Find out more about health check
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
paths:
/domains:
+7 -7
View File
@@ -3,16 +3,16 @@
openapi: 3.0.3
info:
title: SuperMQ Groups Service
title: Magistrala Groups Service
description: |
This is the Groups Server based on the OpenAPI 3.0 specification. It is the HTTP API for managing platform groups. You can now help us improve the API whether it's by making changes to the definition itself or to the code.
Some useful links:
- [The SuperMQ repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.0
servers:
@@ -24,17 +24,17 @@ tags:
description: CRUD operations for your groups
externalDocs:
description: Find out more about users groups
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Roles
description: All operations involving roles for groups
externalDocs:
description: Find out more about roles
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Health
description: Health check operations
externalDocs:
description: Find out more about health checks
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
paths:
/{domainID}/groups:
@@ -1155,7 +1155,7 @@ components:
description: User's last name.
email:
type: string
example: user@supermq.com
example: user@magistrala.com
description: User's email address.
tags:
type: array
+4 -4
View File
@@ -3,16 +3,16 @@
openapi: 3.0.1
info:
title: SuperMQ http adapter
title: Magistrala http adapter
description: |
HTTP API for sending messages through communication channels.
Some useful links:
- [The SuperMQ repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.0
servers:
@@ -24,7 +24,7 @@ tags:
description: Everything about your Messages
externalDocs:
description: Find out more about messages
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
paths:
/m/{domainPrefix}/c/{channelPrefix}:
+3 -3
View File
@@ -3,16 +3,16 @@
openapi: 3.0.3
info:
title: SuperMQ Journal Log Service
title: Magistrala Journal Log Service
description: |
This is the Journal Log Server based on the OpenAPI 3.0 specification. It is the HTTP API for viewing journal log history. You can now help us improve the API whether it's by making changes to the definition itself or to the code.
Some useful links:
- [The SuperMQ repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@mainflux.com
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.0
servers:
+3 -3
View File
@@ -7,12 +7,12 @@ info:
description: |
HTTP API for Notifiers service.
Some useful links:
- [The Magistrala repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.5
servers:
@@ -26,7 +26,7 @@ tags:
description: Everything about your Notifiers
externalDocs:
description: Find out more about notifiers
url: https://docs.magistrala.absmach.eu
url: https://magistrala.absmach.eu/docs/
paths:
/subscriptions:
+3 -3
View File
@@ -7,12 +7,12 @@ info:
description: |
HTTP API for reading messages.
Some useful links:
- [The Magistrala repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.5
servers:
@@ -30,7 +30,7 @@ tags:
description: Everything about your Readers
externalDocs:
description: Find out more about readers
url: https://docs.magistrala.absmach.eu
url: https://magistrala.absmach.eu/docs/
paths:
/{domainID}/channels/{chanId}/messages:
+3 -3
View File
@@ -7,12 +7,12 @@ info:
description: |
HTTP API for managing rules engine service.
Some useful links:
- [The Magistrala repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.5
servers:
@@ -24,7 +24,7 @@ tags:
description: Everything about your Rules Engine
externalDocs:
description: Find out more about rules engine
url: https://docs.magistrala.absmach.eu
url: https://magistrala.absmach.eu/docs/
paths:
/{domainID}/rules:
+8 -8
View File
@@ -3,16 +3,16 @@
openapi: 3.0.3
info:
title: SuperMQ Users Service
title: Magistrala Users Service
description: |
This is the Users Server based on the OpenAPI 3.0 specification. It is the HTTP API for managing platform users. You can now help us improve the API whether it's by making changes to the definition itself or to the code.
Some useful links:
- [The SuperMQ repository](https://github.com/absmach/supermq)
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: info@absmach.eu
license:
name: Apache 2.0
url: https://github.com/absmach/supermq/blob/main/LICENSE
url: https://github.com/absmach/magistrala/blob/main/LICENSE
version: 0.18.0
servers:
@@ -24,12 +24,12 @@ tags:
description: Everything about your Users
externalDocs:
description: Find out more about users
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
- name: Health
description: Health check operations
externalDocs:
description: Find out more about health checks
url: https://docs.supermq.absmach.eu/
url: https://magistrala.absmach.eu/docs/
paths:
/users:
@@ -815,7 +815,7 @@ components:
description: User tags.
email:
type: string
example: "john.doe@supermq.com"
example: "john.doe@magistrala.com"
description: User email for example email address.
credentials:
type: object
@@ -872,7 +872,7 @@ components:
description: User's last name.
email:
type: string
example: user@supermq.com
example: user@magistrala.com
description: User's email address.
tags:
type: array
@@ -987,7 +987,7 @@ components:
properties:
email:
type: string
example: user@supermq.com
example: user@magistrala.com
description: User email address.
required:
- email
+57 -57
View File
@@ -8,7 +8,7 @@ User service is using Auth service gRPC API to obtain login token or password re
- ID - key ID
- Type - one of the three types described below
- IssuerID - an ID of the SuperMQ User who issued the key
- IssuerID - an ID of the Magistrala User who issued the key
- Subject - user ID for which the key is issued
- IssuedAt - the timestamp when the key is issued
- ExpiresAt - the timestamp after which the key is invalid
@@ -29,7 +29,7 @@ API keys are similar to the User keys. The main difference is that API keys have
Recovery key is the password recovery key. It's short-lived token used for password recovery process.
For in-depth explanation of the aforementioned scenarios, as well as thorough understanding of SuperMQ, please check out the [official documentation][doc].
For in-depth explanation of the aforementioned scenarios, as well as thorough understanding of Magistrala, please check out the [official documentation][doc].
The following actions are supported:
@@ -59,63 +59,63 @@ Domain consists of the following fields:
The service is configured using the environment variables presented in the following table. Note that any unset variables will be replaced with their default values.
| Variable | Description | Default |
| :--- | :--- | :--- |
| `MG_AUTH_LOG_LEVEL` | Log level for the Auth service (debug, info, warn, error) | info |
| `MG_AUTH_DB_HOST` | Database host address | localhost |
| `MG_AUTH_DB_PORT` | Database host port | 5432 |
| `MG_AUTH_DB_USER` | Database user | supermq |
| `MG_AUTH_DB_PASSWORD` | Database password | supermq |
| `MG_AUTH_DB_NAME` | Name of the database used by the service | auth |
| `MG_AUTH_DB_SSL_MODE` | Database connection SSL mode (disable, require, verify-ca, verify-full) | disable |
| `MG_AUTH_DB_SSL_CERT` | Path to the PEM encoded certificate file | "" |
| `MG_AUTH_DB_SSL_KEY` | Path to the PEM encoded key file | "" |
| `MG_AUTH_DB_SSL_ROOT_CERT` | Path to the PEM encoded root certificate file | "" |
| `MG_AUTH_HTTP_HOST` | Auth service HTTP host | "" |
| `MG_AUTH_HTTP_PORT` | Auth service HTTP port | 8189 |
| `MG_AUTH_HTTP_SERVER_CERT` | Path to the PEM encoded HTTP server certificate file | "" |
| `MG_AUTH_HTTP_SERVER_KEY` | Path to the PEM encoded HTTP server key file | "" |
| `MG_AUTH_GRPC_HOST` | Auth service gRPC host | "" |
| `MG_AUTH_GRPC_PORT` | Auth service gRPC port | 8181 |
| `MG_AUTH_GRPC_SERVER_CERT` | Path to the PEM encoded gRPC server certificate file | "" |
| `MG_AUTH_GRPC_SERVER_KEY` | Path to the PEM encoded gRPC server key file | "" |
| `MG_AUTH_GRPC_SERVER_CA_CERTS` | Path to the PEM encoded gRPC server CA certificate file | "" |
| `MG_AUTH_GRPC_CLIENT_CA_CERTS` | Path to the PEM encoded gRPC client CA certificate file | "" |
| `MG_AUTH_SECRET_KEY` | String used for signing tokens | secret |
| `MG_AUTH_ACCESS_TOKEN_DURATION` | The access token expiration period | 1h |
| `MG_AUTH_REFRESH_TOKEN_DURATION` | The refresh token expiration period | 24h |
| `MG_AUTH_INVITATION_DURATION` | The invitation token expiration period | 168h |
| `MG_AUTH_CACHE_URL` | Redis URL for caching PAT scopes | redis://localhost:6379/0 |
| `MG_AUTH_CACHE_KEY_DURATION` | Duration for which PAT scope cache keys are valid | 10m |
| `MG_SPICEDB_HOST` | SpiceDB host address | localhost |
| `MG_SPICEDB_PORT` | SpiceDB host port | 50051 |
| `MG_SPICEDB_PRE_SHARED_KEY` | SpiceDB pre-shared key | 12345678 |
| `MG_SPICEDB_SCHEMA_FILE` | Path to SpiceDB schema file | ./docker/spicedb/schema.zed |
| `MG_JAEGER_URL` | Jaeger server URL | <http://jaeger:4318/v1/traces> |
| `MG_JAEGER_TRACE_RATIO` | Jaeger sampling ratio | 1.0 |
| `MG_SEND_TELEMETRY` | Send telemetry to supermq call home server | true |
| `MG_ADAPTER_INSTANCE_ID` | Adapter instance ID | "" |
| `MG_CALLOUT_URLS` | Comma-separated list of callout URLs | "" |
| `MG_CALLOUT_METHOD` | Callout method | POST |
| `MG_CALLOUT_TLS_VERIFICATION` | Enable TLS verification for callouts | true |
| `MG_CALLOUT_TIMEOUT` | Callout timeout | 10s |
| `MG_CALLOUT_CA_CERT` | Path to CA certificate file | "" |
| `MG_CALLOUT_CERT` | Path to client certificate file | "" |
| `MG_CALLOUT_KEY` | Path to client key file | "" |
| `MG_CALLOUT_OPERATIONS` | Invoke callout if the authorization permission matches any of the given permissions. | "" |
| Variable | Description | Default |
| :------------------------------- | :----------------------------------------------------------------------------------- | :----------------------------- |
| `MG_AUTH_LOG_LEVEL` | Log level for the Auth service (debug, info, warn, error) | info |
| `MG_AUTH_DB_HOST` | Database host address | localhost |
| `MG_AUTH_DB_PORT` | Database host port | 5432 |
| `MG_AUTH_DB_USER` | Database user | magistrala |
| `MG_AUTH_DB_PASSWORD` | Database password | magistrala |
| `MG_AUTH_DB_NAME` | Name of the database used by the service | auth |
| `MG_AUTH_DB_SSL_MODE` | Database connection SSL mode (disable, require, verify-ca, verify-full) | disable |
| `MG_AUTH_DB_SSL_CERT` | Path to the PEM encoded certificate file | "" |
| `MG_AUTH_DB_SSL_KEY` | Path to the PEM encoded key file | "" |
| `MG_AUTH_DB_SSL_ROOT_CERT` | Path to the PEM encoded root certificate file | "" |
| `MG_AUTH_HTTP_HOST` | Auth service HTTP host | "" |
| `MG_AUTH_HTTP_PORT` | Auth service HTTP port | 8189 |
| `MG_AUTH_HTTP_SERVER_CERT` | Path to the PEM encoded HTTP server certificate file | "" |
| `MG_AUTH_HTTP_SERVER_KEY` | Path to the PEM encoded HTTP server key file | "" |
| `MG_AUTH_GRPC_HOST` | Auth service gRPC host | "" |
| `MG_AUTH_GRPC_PORT` | Auth service gRPC port | 8181 |
| `MG_AUTH_GRPC_SERVER_CERT` | Path to the PEM encoded gRPC server certificate file | "" |
| `MG_AUTH_GRPC_SERVER_KEY` | Path to the PEM encoded gRPC server key file | "" |
| `MG_AUTH_GRPC_SERVER_CA_CERTS` | Path to the PEM encoded gRPC server CA certificate file | "" |
| `MG_AUTH_GRPC_CLIENT_CA_CERTS` | Path to the PEM encoded gRPC client CA certificate file | "" |
| `MG_AUTH_SECRET_KEY` | String used for signing tokens | secret |
| `MG_AUTH_ACCESS_TOKEN_DURATION` | The access token expiration period | 1h |
| `MG_AUTH_REFRESH_TOKEN_DURATION` | The refresh token expiration period | 24h |
| `MG_AUTH_INVITATION_DURATION` | The invitation token expiration period | 168h |
| `MG_AUTH_CACHE_URL` | Redis URL for caching PAT scopes | redis://localhost:6379/0 |
| `MG_AUTH_CACHE_KEY_DURATION` | Duration for which PAT scope cache keys are valid | 10m |
| `MG_SPICEDB_HOST` | SpiceDB host address | localhost |
| `MG_SPICEDB_PORT` | SpiceDB host port | 50051 |
| `MG_SPICEDB_PRE_SHARED_KEY` | SpiceDB pre-shared key | 12345678 |
| `MG_SPICEDB_SCHEMA_FILE` | Path to SpiceDB schema file | ./docker/spicedb/schema.zed |
| `MG_JAEGER_URL` | Jaeger server URL | <http://jaeger:4318/v1/traces> |
| `MG_JAEGER_TRACE_RATIO` | Jaeger sampling ratio | 1.0 |
| `MG_SEND_TELEMETRY` | Send telemetry to magistrala call home server | true |
| `MG_ADAPTER_INSTANCE_ID` | Adapter instance ID | "" |
| `MG_CALLOUT_URLS` | Comma-separated list of callout URLs | "" |
| `MG_CALLOUT_METHOD` | Callout method | POST |
| `MG_CALLOUT_TLS_VERIFICATION` | Enable TLS verification for callouts | true |
| `MG_CALLOUT_TIMEOUT` | Callout timeout | 10s |
| `MG_CALLOUT_CA_CERT` | Path to CA certificate file | "" |
| `MG_CALLOUT_CERT` | Path to client certificate file | "" |
| `MG_CALLOUT_KEY` | Path to client key file | "" |
| `MG_CALLOUT_OPERATIONS` | Invoke callout if the authorization permission matches any of the given permissions. | "" |
## Deployment
The service itself is distributed as Docker container. Check the [`auth`](https://github.com/absmach/supermq/blob/main/docker/docker-compose.yaml) service section in docker-compose file to see how service is deployed.
The service itself is distributed as Docker container. Check the [`auth`](https://github.com/absmach/magistrala/blob/main/docker/docker-compose.yaml) service section in docker-compose file to see how service is deployed.
Running this service outside of container requires working instance of the postgres database, SpiceDB, and Jaeger server.
To start the service outside of the container, execute the following shell script:
```bash
# download the latest version of the service
git clone https://github.com/absmach/supermq
git clone https://github.com/absmach/magistrala
cd supermq
cd magistrala
# compile the service
make auth
@@ -127,8 +127,8 @@ make install
MG_AUTH_LOG_LEVEL=info \
MG_AUTH_DB_HOST=localhost \
MG_AUTH_DB_PORT=5432 \
MG_AUTH_DB_USER=supermq \
MG_AUTH_DB_PASSWORD=supermq \
MG_AUTH_DB_USER=magistrala \
MG_AUTH_DB_PASSWORD=magistrala \
MG_AUTH_DB_NAME=auth \
MG_AUTH_DB_SSL_MODE=disable \
MG_AUTH_DB_SSL_CERT="" \
@@ -159,7 +159,7 @@ MG_AUTH_ADAPTER_INSTANCE_ID="" \
MG_CALLOUT_URLS="" \
MG_CALLOUT_METHOD="POST" \
MG_CALLOUT_TLS_VERIFICATION=true \
$GOBIN/supermq-auth
$GOBIN/magistrala-auth
```
Setting `MG_AUTH_HTTP_SERVER_CERT` and `MG_AUTH_HTTP_SERVER_KEY` will enable TLS against the service. The service expects a file in PEM format for both the certificate and the key.
@@ -167,11 +167,11 @@ Setting `MG_AUTH_GRPC_SERVER_CERT` and `MG_AUTH_GRPC_SERVER_KEY` will enable TLS
## Personal Access Tokens (PATs)
Personal Access Tokens (PATs) provide a secure way to authenticate with SuperMQ APIs without using your primary credentials. They are particularly useful for automation, CI/CD pipelines, and integrating with third-party services.
Personal Access Tokens (PATs) provide a secure way to authenticate with Magistrala APIs without using your primary credentials. They are particularly useful for automation, CI/CD pipelines, and integrating with third-party services.
### Overview
PATs in SuperMQ are designed with the following features:
PATs in Magistrala are designed with the following features:
- **Scoped Access**: Each token can be limited to specific operations on specific resources
- **Expiration Control**: Set custom expiration times for tokens
@@ -195,7 +195,7 @@ Where:
### PAT Operations
SuperMQ supports the following operations for PATs:
Magistrala supports the following operations for PATs:
| Operation | Description |
| ----------- | ------------------------------------ |
@@ -444,6 +444,6 @@ When a PAT is used for authentication:
## Usage
For more information about service capabilities and its usage, please check out the [API documentation](https://docs.api.supermq.absmach.eu/?urls.primaryName=auth.yaml).
For more information about service capabilities and its usage, please check out the [API documentation](https://docs.api.magistrala.absmach.eu/?urls.primaryName=auth.yaml).
[doc]: https://docs.supermq.absmach.eu/
[doc]: https://magistrala.absmach.eu/docs/
+3 -3
View File
@@ -7,9 +7,9 @@ import (
"context"
"time"
grpcAuthV1 "github.com/absmach/supermq/api/grpc/auth/v1"
"github.com/absmach/supermq/auth"
grpcapi "github.com/absmach/supermq/auth/api/grpc"
grpcAuthV1 "github.com/absmach/magistrala/api/grpc/auth/v1"
"github.com/absmach/magistrala/auth"
grpcapi "github.com/absmach/magistrala/auth/api/grpc"
"github.com/go-kit/kit/endpoint"
kitgrpc "github.com/go-kit/kit/transport/grpc"
"google.golang.org/grpc"
+2 -2
View File
@@ -6,8 +6,8 @@ package auth
import (
"context"
"github.com/absmach/supermq/auth"
"github.com/absmach/supermq/pkg/policies"
"github.com/absmach/magistrala/auth"
"github.com/absmach/magistrala/pkg/policies"
"github.com/go-kit/kit/endpoint"
)
+8 -8
View File
@@ -10,14 +10,14 @@ import (
"testing"
"time"
grpcAuthV1 "github.com/absmach/supermq/api/grpc/auth/v1"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
grpcapi "github.com/absmach/supermq/auth/api/grpc/auth"
"github.com/absmach/supermq/internal/testsutil"
"github.com/absmach/supermq/pkg/errors"
svcerr "github.com/absmach/supermq/pkg/errors/service"
"github.com/absmach/supermq/pkg/policies"
grpcAuthV1 "github.com/absmach/magistrala/api/grpc/auth/v1"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/auth"
grpcapi "github.com/absmach/magistrala/auth/api/grpc/auth"
"github.com/absmach/magistrala/internal/testsutil"
"github.com/absmach/magistrala/pkg/errors"
svcerr "github.com/absmach/magistrala/pkg/errors/service"
"github.com/absmach/magistrala/pkg/policies"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"google.golang.org/grpc"
+1 -1
View File
@@ -4,7 +4,7 @@
package auth
import (
apiutil "github.com/absmach/supermq/api/http/util"
apiutil "github.com/absmach/magistrala/api/http/util"
)
type authenticateReq struct {
+1 -1
View File
@@ -3,7 +3,7 @@
package auth
import smqauth "github.com/absmach/supermq/auth"
import smqauth "github.com/absmach/magistrala/auth"
type authenticateRes struct {
id string
+3 -3
View File
@@ -6,9 +6,9 @@ package auth
import (
"context"
grpcAuthV1 "github.com/absmach/supermq/api/grpc/auth/v1"
"github.com/absmach/supermq/auth"
grpcapi "github.com/absmach/supermq/auth/api/grpc"
grpcAuthV1 "github.com/absmach/magistrala/api/grpc/auth/v1"
"github.com/absmach/magistrala/auth"
grpcapi "github.com/absmach/magistrala/auth/api/grpc"
kitgrpc "github.com/go-kit/kit/transport/grpc"
)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"os"
"testing"
"github.com/absmach/supermq/auth/mocks"
"github.com/absmach/magistrala/auth/mocks"
)
var svc *mocks.Service
+3 -3
View File
@@ -7,9 +7,9 @@ import (
"context"
"time"
grpcTokenV1 "github.com/absmach/supermq/api/grpc/token/v1"
"github.com/absmach/supermq/auth"
grpcapi "github.com/absmach/supermq/auth/api/grpc"
grpcTokenV1 "github.com/absmach/magistrala/api/grpc/token/v1"
"github.com/absmach/magistrala/auth"
grpcapi "github.com/absmach/magistrala/auth/api/grpc"
"github.com/go-kit/kit/endpoint"
kitgrpc "github.com/go-kit/kit/transport/grpc"
"google.golang.org/grpc"
+1 -1
View File
@@ -6,7 +6,7 @@ package token
import (
"context"
"github.com/absmach/supermq/auth"
"github.com/absmach/magistrala/auth"
"github.com/go-kit/kit/endpoint"
)
+7 -7
View File
@@ -10,13 +10,13 @@ import (
"testing"
"time"
grpcTokenV1 "github.com/absmach/supermq/api/grpc/token/v1"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
grpcapi "github.com/absmach/supermq/auth/api/grpc/token"
"github.com/absmach/supermq/internal/testsutil"
"github.com/absmach/supermq/pkg/errors"
svcerr "github.com/absmach/supermq/pkg/errors/service"
grpcTokenV1 "github.com/absmach/magistrala/api/grpc/token/v1"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/auth"
grpcapi "github.com/absmach/magistrala/auth/api/grpc/token"
"github.com/absmach/magistrala/internal/testsutil"
"github.com/absmach/magistrala/pkg/errors"
svcerr "github.com/absmach/magistrala/pkg/errors/service"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"google.golang.org/grpc"
+2 -2
View File
@@ -4,8 +4,8 @@
package token
import (
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/auth"
)
type issueReq struct {
+1 -1
View File
@@ -3,7 +3,7 @@
package token
import "github.com/absmach/supermq/auth"
import "github.com/absmach/magistrala/auth"
type issueRes struct {
accessToken string
+3 -3
View File
@@ -6,9 +6,9 @@ package token
import (
"context"
grpcTokenV1 "github.com/absmach/supermq/api/grpc/token/v1"
"github.com/absmach/supermq/auth"
grpcapi "github.com/absmach/supermq/auth/api/grpc"
grpcTokenV1 "github.com/absmach/magistrala/api/grpc/token/v1"
"github.com/absmach/magistrala/auth"
grpcapi "github.com/absmach/magistrala/auth/api/grpc"
kitgrpc "github.com/go-kit/kit/transport/grpc"
)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"os"
"testing"
"github.com/absmach/supermq/auth/mocks"
"github.com/absmach/magistrala/auth/mocks"
)
var svc *mocks.Service
+4 -4
View File
@@ -6,10 +6,10 @@ package grpc
import (
"fmt"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
"github.com/absmach/supermq/pkg/errors"
svcerr "github.com/absmach/supermq/pkg/errors/service"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/auth"
"github.com/absmach/magistrala/pkg/errors"
svcerr "github.com/absmach/magistrala/pkg/errors/service"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"context"
"time"
"github.com/absmach/supermq/auth"
"github.com/absmach/magistrala/auth"
"github.com/go-kit/kit/endpoint"
)
+7 -7
View File
@@ -13,12 +13,12 @@ import (
"testing"
"time"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
httpapi "github.com/absmach/supermq/auth/api/http"
"github.com/absmach/supermq/auth/mocks"
smqlog "github.com/absmach/supermq/logger"
svcerr "github.com/absmach/supermq/pkg/errors/service"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/auth"
httpapi "github.com/absmach/magistrala/auth/api/http"
"github.com/absmach/magistrala/auth/mocks"
mglog "github.com/absmach/magistrala/logger"
svcerr "github.com/absmach/magistrala/pkg/errors/service"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
@@ -66,7 +66,7 @@ func (tr testRequest) make() (*http.Response, error) {
func newServer() (*httptest.Server, *mocks.Service) {
svc := new(mocks.Service)
mux := httpapi.MakeHandler(svc, smqlog.NewMock(), "", 900, 60)
mux := httpapi.MakeHandler(svc, mglog.NewMock(), "", 900, 60)
return httptest.NewServer(mux), svc
}
+2 -2
View File
@@ -6,8 +6,8 @@ package keys
import (
"time"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/auth"
)
type issueKeyReq struct {
+2 -2
View File
@@ -6,8 +6,8 @@ package keys
import (
"testing"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/auth"
"github.com/stretchr/testify/assert"
)
+6 -6
View File
@@ -9,15 +9,15 @@ import (
"net/http"
"time"
"github.com/absmach/supermq"
"github.com/absmach/supermq/auth"
"github.com/absmach/magistrala"
"github.com/absmach/magistrala/auth"
)
var (
_ supermq.Response = (*issueKeyRes)(nil)
_ supermq.Response = (*revokeKeyRes)(nil)
_ supermq.Response = (*retrieveKeyRes)(nil)
_ supermq.Response = (*retrieveJWKSRes)(nil)
_ magistrala.Response = (*issueKeyRes)(nil)
_ magistrala.Response = (*revokeKeyRes)(nil)
_ magistrala.Response = (*retrieveKeyRes)(nil)
_ magistrala.Response = (*retrieveJWKSRes)(nil)
)
type issueKeyRes struct {
+4 -4
View File
@@ -10,10 +10,10 @@ import (
"net/http"
"strings"
api "github.com/absmach/supermq/api/http"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
"github.com/absmach/supermq/pkg/errors"
api "github.com/absmach/magistrala/api/http"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/auth"
"github.com/absmach/magistrala/pkg/errors"
"github.com/go-chi/chi/v5"
kithttp "github.com/go-kit/kit/transport/http"
)
+1 -1
View File
@@ -6,7 +6,7 @@ package pats
import (
"context"
"github.com/absmach/supermq/auth"
"github.com/absmach/magistrala/auth"
"github.com/go-kit/kit/endpoint"
)
+3 -3
View File
@@ -8,9 +8,9 @@ import (
"strings"
"time"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
"github.com/absmach/supermq/pkg/errors"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/auth"
"github.com/absmach/magistrala/pkg/errors"
)
type createPatReq struct {
+2 -2
View File
@@ -8,8 +8,8 @@ import (
"testing"
"time"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
apiutil "github.com/absmach/magistrala/api/http/util"
"github.com/absmach/magistrala/auth"
"github.com/stretchr/testify/assert"
)
+11 -11
View File
@@ -6,20 +6,20 @@ package pats
import (
"net/http"
"github.com/absmach/supermq"
"github.com/absmach/supermq/auth"
"github.com/absmach/magistrala"
"github.com/absmach/magistrala/auth"
)
var (
_ supermq.Response = (*createPatRes)(nil)
_ supermq.Response = (*retrievePatRes)(nil)
_ supermq.Response = (*updatePatNameRes)(nil)
_ supermq.Response = (*updatePatDescriptionRes)(nil)
_ supermq.Response = (*deletePatRes)(nil)
_ supermq.Response = (*resetPatSecretRes)(nil)
_ supermq.Response = (*revokePatSecretRes)(nil)
_ supermq.Response = (*scopeRes)(nil)
_ supermq.Response = (*clearAllRes)(nil)
_ magistrala.Response = (*createPatRes)(nil)
_ magistrala.Response = (*retrievePatRes)(nil)
_ magistrala.Response = (*updatePatNameRes)(nil)
_ magistrala.Response = (*updatePatDescriptionRes)(nil)
_ magistrala.Response = (*deletePatRes)(nil)
_ magistrala.Response = (*resetPatSecretRes)(nil)
_ magistrala.Response = (*revokePatSecretRes)(nil)
_ magistrala.Response = (*scopeRes)(nil)
_ magistrala.Response = (*clearAllRes)(nil)
)
type createPatRes struct {

Some files were not shown because too many files have changed in this diff Show More