mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-17 02:53:11 -06:00
* Latest dendrite main (8c7b274e4e)
* Gating implementation from John and Tak
Fixes for https://github.com/matrix-org/dendrite/issues/2838 and
https://github.com/matrix-org/dendrite/issues/2842
Co-authored-by: Tak Wai Wong <tak@hntlabs.com>
25 lines
717 B
Go
25 lines
717 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 NewAuthorization(cfg *config.ClientAPI, rsAPI roomserver.ClientRoomserverAPI) authorization.Authorization {
|
|
// Load authorization manager for Zion
|
|
if cfg.PublicKeyAuthentication.Ethereum.GetEnableAuthZ() {
|
|
auth, err := zion.NewZionAuthorization(cfg, rsAPI)
|
|
|
|
if err != nil {
|
|
log.Errorln("Failed to initialise Zion authorization manager. Using default.", err)
|
|
} else {
|
|
return auth
|
|
}
|
|
}
|
|
|
|
return &authorization.DefaultAuthorization{}
|
|
}
|