Skip to content

Commit

Permalink
feat: upgrade github.com/tx7do/kratos-casbin (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
tscuite authored May 28, 2024
1 parent ecf7a97 commit 527745a
Show file tree
Hide file tree
Showing 3 changed files with 1,438 additions and 52 deletions.
6 changes: 6 additions & 0 deletions casbin/app/admin/internal/pkg/authz/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"

"github.com/go-kratos/kratos/v2/middleware/auth/jwt"
"github.com/go-kratos/kratos/v2/transport"
jwtV4 "github.com/golang-jwt/jwt/v4"
Expand All @@ -18,6 +19,7 @@ type SecurityUser struct {
Path string
Method string
AuthorityId string
Domain string
}

func NewSecurityUser() authzM.SecurityUser {
Expand Down Expand Up @@ -53,6 +55,10 @@ func (su *SecurityUser) GetAction() string {
return su.Method
}

func (su *SecurityUser) GetDomain() string {
return su.Domain
}

func (su *SecurityUser) CreateAccessJwtToken(secretKey []byte) string {
claims := jwtV4.NewWithClaims(jwtV4.SigningMethodHS256,
jwtV4.MapClaims{
Expand Down
24 changes: 9 additions & 15 deletions casbin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,24 @@ require (
github.com/go-kratos/kratos/contrib/config/etcd/v2 v2.0.0-20220301141459-ed6ab7caf9ca
github.com/go-kratos/kratos/contrib/config/nacos/v2 v2.0.0-20220301141459-ed6ab7caf9ca
github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20211119091424-ef3322ec0764
github.com/go-kratos/kratos/v2 v2.2.0
github.com/go-kratos/kratos/v2 v2.7.2
github.com/google/wire v0.5.0
github.com/hashicorp/consul/api v1.11.0
github.com/nacos-group/nacos-sdk-go v1.1.0
go.etcd.io/etcd/client/v3 v3.5.2
go.opentelemetry.io/otel v1.3.0
go.opentelemetry.io/otel v1.16.0
go.opentelemetry.io/otel/exporters/jaeger v1.0.0
go.opentelemetry.io/otel/sdk v1.3.0
google.golang.org/grpc v1.45.0
google.golang.org/protobuf v1.27.1
go.opentelemetry.io/otel/sdk v1.16.0
google.golang.org/grpc v1.58.2
google.golang.org/protobuf v1.31.0
)

require (
github.com/armon/go-metrics v0.3.10 // indirect
github.com/casbin/casbin/v2 v2.42.0
github.com/casbin/casbin/v2 v2.84.0
github.com/fatih/color v1.13.0 // indirect
github.com/go-kratos/swagger-api v1.0.1
github.com/golang-jwt/jwt/v4 v4.2.0
github.com/google/go-cmp v0.5.7 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/gorilla/handlers v1.5.1
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand All @@ -35,15 +34,10 @@ require (
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/serf v0.9.6 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/stretchr/objx v0.3.0 // indirect
github.com/tx7do/kratos-casbin v0.0.0-20220317124747-964d93859d7d
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220111092808-5a964db01320 // indirect
google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
github.com/tx7do/kratos-casbin v0.0.0-20240311042652-fbaa11f94322
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5
gopkg.in/ini.v1 v1.51.0 // indirect
)
Loading

0 comments on commit 527745a

Please sign in to comment.