mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-17 11:03:11 -06:00
Pulls in upstream latest changes from [dendrite-fork ](https://github.com/HereNotThere/dendrite)to subtree at servers/dendrite here. Co-authored-by: Tak Wai Wong <64229756+tak-hntlabs@users.noreply.github.com> Co-authored-by: Tak Wai Wong <tak@hntlabs.com> Co-authored-by: John Terzis <john@hntlabs.com>
25 lines
707 B
Go
25 lines
707 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.EnableAuthz {
|
|
auth, err := zion.NewZionAuthorization(rsAPI)
|
|
|
|
if err != nil {
|
|
log.Errorln("Failed to initialise Zion authorization manager. Using default.", err)
|
|
} else {
|
|
return auth
|
|
}
|
|
}
|
|
|
|
return &authorization.DefaultAuthorization{}
|
|
}
|