fix: return absolute asset urls (#3676)

This commit is contained in:
Livio Amstutz
2022-05-20 10:30:12 +02:00
committed by GitHub
parent db0e7495e7
commit 62c4a4d08d
16 changed files with 45 additions and 34 deletions

View File

@@ -15,7 +15,7 @@ func (s *Server) GetMyProfile(ctx context.Context, req *auth_pb.GetMyProfileRequ
return nil, err
}
return &auth_pb.GetMyProfileResponse{
Profile: user_grpc.ProfileToPb(profile, s.assetsAPIDomain),
Profile: user_grpc.ProfileToPb(profile, s.assetsAPIDomain(ctx)),
Details: object_grpc.ToViewDetailsPb(
profile.Sequence,
profile.CreationDate,

View File

@@ -1,10 +1,12 @@
package auth
import (
"context"
"time"
"google.golang.org/grpc"
"github.com/zitadel/zitadel/internal/api/assets"
"github.com/zitadel/zitadel/internal/api/authz"
"github.com/zitadel/zitadel/internal/api/grpc/server"
"github.com/zitadel/zitadel/internal/auth/repository"
@@ -28,7 +30,7 @@ type Server struct {
query *query.Queries
repo repository.Repository
defaults systemdefaults.SystemDefaults
assetsAPIDomain string
assetsAPIDomain func(context.Context) string
userCodeAlg crypto.EncryptionAlgorithm
externalSecure bool
auditLogRetention time.Duration
@@ -42,7 +44,6 @@ func CreateServer(command *command.Commands,
query *query.Queries,
authRepo repository.Repository,
defaults systemdefaults.SystemDefaults,
assetsAPIDomain string,
userCodeAlg crypto.EncryptionAlgorithm,
externalSecure bool,
auditLogRetention time.Duration,
@@ -52,7 +53,7 @@ func CreateServer(command *command.Commands,
query: query,
repo: authRepo,
defaults: defaults,
assetsAPIDomain: assetsAPIDomain,
assetsAPIDomain: assets.AssetAPI(externalSecure),
userCodeAlg: userCodeAlg,
externalSecure: externalSecure,
auditLogRetention: auditLogRetention,

View File

@@ -20,7 +20,7 @@ func (s *Server) GetMyUser(ctx context.Context, _ *auth_pb.GetMyUserRequest) (*a
if err != nil {
return nil, err
}
return &auth_pb.GetMyUserResponse{User: user_grpc.UserToPb(user, s.assetsAPIDomain)}, nil
return &auth_pb.GetMyUserResponse{User: user_grpc.UserToPb(user, s.assetsAPIDomain(ctx))}, nil
}
func (s *Server) RemoveMyUser(ctx context.Context, _ *auth_pb.RemoveMyUserRequest) (*auth_pb.RemoveMyUserResponse, error) {
@@ -61,7 +61,7 @@ func (s *Server) ListMyUserChanges(ctx context.Context, req *auth_pb.ListMyUserC
return nil, err
}
return &auth_pb.ListMyUserChangesResponse{
Result: change.ChangesToPb(changes.Changes, s.assetsAPIDomain),
Result: change.ChangesToPb(changes.Changes, s.assetsAPIDomain(ctx)),
}, nil
}