mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-17 02:53:11 -06:00
25 lines
745 B
Go
25 lines
745 B
Go
package authorization
|
|
|
|
import (
|
|
"github.com/matrix-org/dendrite/authorization"
|
|
roomserver "github.com/matrix-org/dendrite/roomserver/api"
|
|
"github.com/matrix-org/dendrite/setup/config"
|
|
"github.com/matrix-org/dendrite/zion"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func NewRoomserverAuthorization(cfg *config.ClientAPI, roomQueryAPI roomserver.QueryEventsAPI) authorization.Authorization {
|
|
// Load authorization manager for Zion
|
|
if cfg.PublicKeyAuthentication.Ethereum.GetEnableAuthZ() {
|
|
auth, err := zion.NewZionAuthorization(cfg, roomQueryAPI)
|
|
|
|
if err != nil {
|
|
log.Errorf("failed to initialise Zion authorization manager, using default. Error: %v", err)
|
|
} else {
|
|
return auth
|
|
}
|
|
}
|
|
|
|
return &authorization.DefaultAuthorization{}
|
|
}
|