mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
* import new versions of the zion contracts * bootstrap zion authz * define interface for space manager contract * instantiate spacemanager interface * load goerli and localhost * embed json * remove zion interface. Use contracts directly * split user identifiter into address and chain id * isAllowed in routing.go * remove permission.go Co-authored-by: Tak Wai Wong <tak@hntlabs.com>
24 lines
604 B
Go
24 lines
604 B
Go
package authorization
|
|
|
|
import (
|
|
"github.com/matrix-org/dendrite/authorization"
|
|
"github.com/matrix-org/dendrite/setup/config"
|
|
"github.com/matrix-org/dendrite/zion"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func NewAuthorization(cfg *config.ClientAPI) authorization.Authorization {
|
|
// Load authorization manager for Zion
|
|
if cfg.PublicKeyAuthentication.Ethereum.EnableAuthz {
|
|
auth, err := zion.NewZionAuthorization()
|
|
|
|
if err != nil {
|
|
log.Errorln("Failed to initialise Zion authorization manager. Using default.", err)
|
|
} else {
|
|
return auth
|
|
}
|
|
}
|
|
|
|
return &authorization.DefaultAuthorization{}
|
|
}
|