mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-07 21:00:30 -06:00
Adjust import paths and service urls in index.js
This commit is contained in:
@@ -7,12 +7,13 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
|
||||
|
||||
"github.com/coreos/go-oidc/v3/oidc"
|
||||
"github.com/cs3org/reva/pkg/token/manager/jwt"
|
||||
chimiddleware "github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/justinas/alice"
|
||||
"github.com/oklog/run"
|
||||
acc "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
pkgmiddleware "github.com/owncloud/ocis/ocis-pkg/middleware"
|
||||
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||
@@ -139,7 +140,7 @@ func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config)
|
||||
Msg("Failed to create token manager")
|
||||
}
|
||||
userProvider = backend.NewAccountsServiceUserBackend(
|
||||
acc.NewAccountsService("com.owncloud.api.accounts", grpc.DefaultClient),
|
||||
accountssvc.NewAccountsService("com.owncloud.api.accounts", grpc.DefaultClient),
|
||||
rolesClient,
|
||||
cfg.OIDC.Issuer,
|
||||
tokenManager,
|
||||
|
||||
@@ -132,7 +132,7 @@ func DefaultPolicies() []Policy {
|
||||
},
|
||||
// if we were using the go micro api gateway we could look up the endpoint in the registry dynamically
|
||||
{
|
||||
Endpoint: "/api/v0/accounts",
|
||||
Endpoint: "/api/v1/accounts",
|
||||
Backend: "http://localhost:9181",
|
||||
},
|
||||
// TODO the lookup needs a better mechanism
|
||||
|
||||
@@ -8,8 +8,9 @@ import (
|
||||
|
||||
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
||||
|
||||
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
|
||||
|
||||
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
|
||||
acc "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/proxy/pkg/config"
|
||||
storepb "github.com/owncloud/ocis/store/pkg/proto/v0"
|
||||
@@ -29,7 +30,7 @@ type Options struct {
|
||||
// HTTPClient to use for communication with the oidcAuth provider
|
||||
HTTPClient *http.Client
|
||||
// AccountsClient for resolving accounts
|
||||
AccountsClient acc.AccountsService
|
||||
AccountsClient accountssvc.AccountsService
|
||||
// UP
|
||||
UserProvider backend.UserBackend
|
||||
// SettingsRoleService for the roles API in settings
|
||||
@@ -100,7 +101,7 @@ func HTTPClient(c *http.Client) Option {
|
||||
}
|
||||
|
||||
// AccountsClient provides a function to set the accounts client config option.
|
||||
func AccountsClient(ac acc.AccountsService) Option {
|
||||
func AccountsClient(ac accountssvc.AccountsService) Option {
|
||||
return func(o *Options) {
|
||||
o.AccountsClient = ac
|
||||
}
|
||||
|
||||
@@ -6,9 +6,10 @@ import (
|
||||
"regexp"
|
||||
"sort"
|
||||
|
||||
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
|
||||
|
||||
"github.com/asim/go-micro/plugins/client/grpc/v4"
|
||||
revactx "github.com/cs3org/reva/pkg/ctx"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/owncloud/ocis/ocis-pkg/oidc"
|
||||
"github.com/owncloud/ocis/proxy/pkg/config"
|
||||
)
|
||||
@@ -84,7 +85,7 @@ func LoadSelector(cfg *config.PolicySelector) (Selector, error) {
|
||||
if cfg.Migration != nil {
|
||||
return NewMigrationSelector(
|
||||
cfg.Migration,
|
||||
accounts.NewAccountsService("com.owncloud.accounts", grpc.NewClient())), nil
|
||||
accountssvc.NewAccountsService("com.owncloud.accounts", grpc.NewClient())), nil
|
||||
}
|
||||
|
||||
if cfg.Claims != nil {
|
||||
@@ -129,7 +130,7 @@ func NewStaticSelector(cfg *config.StaticSelectorConf) Selector {
|
||||
//
|
||||
// This selector can be used in migration-scenarios where some users have already migrated from ownCloud10 to OCIS and
|
||||
// thus have an entry in ocis-accounts. All users without accounts entry are routed to the legacy ownCloud10 instance.
|
||||
func NewMigrationSelector(cfg *config.MigrationSelectorConf, ss accounts.AccountsService) Selector {
|
||||
func NewMigrationSelector(cfg *config.MigrationSelectorConf, ss accountssvc.AccountsService) Selector {
|
||||
var acc = ss
|
||||
return func(r *http.Request) (s string, err error) {
|
||||
var claims map[string]interface{}
|
||||
@@ -144,7 +145,7 @@ func NewMigrationSelector(cfg *config.MigrationSelectorConf, ss accounts.Account
|
||||
return cfg.AccNotFoundPolicy, nil
|
||||
}
|
||||
|
||||
if _, err := acc.GetAccount(r.Context(), &accounts.GetAccountRequest{Id: userID}); err != nil {
|
||||
if _, err := acc.GetAccount(r.Context(), &accountssvc.GetAccountRequest{Id: userID}); err != nil {
|
||||
return cfg.AccNotFoundPolicy, nil
|
||||
}
|
||||
return cfg.AccFoundPolicy, nil
|
||||
|
||||
@@ -6,18 +6,20 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
accountsmsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/accounts/v1"
|
||||
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
|
||||
|
||||
cs3 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
"github.com/cs3org/reva/pkg/auth/scope"
|
||||
"github.com/cs3org/reva/pkg/token"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/oidc"
|
||||
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
|
||||
)
|
||||
|
||||
// NewAccountsServiceUserBackend creates a user-provider which fetches users from the ocis accounts-service
|
||||
func NewAccountsServiceUserBackend(ac accounts.AccountsService, rs settings.RoleService, oidcISS string, tokenManager token.Manager, logger log.Logger) UserBackend {
|
||||
func NewAccountsServiceUserBackend(ac accountssvc.AccountsService, rs settings.RoleService, oidcISS string, tokenManager token.Manager, logger log.Logger) UserBackend {
|
||||
return &accountsServiceBackend{
|
||||
accountsClient: ac,
|
||||
settingsRoleService: rs,
|
||||
@@ -28,7 +30,7 @@ func NewAccountsServiceUserBackend(ac accounts.AccountsService, rs settings.Role
|
||||
}
|
||||
|
||||
type accountsServiceBackend struct {
|
||||
accountsClient accounts.AccountsService
|
||||
accountsClient accountssvc.AccountsService
|
||||
settingsRoleService settings.RoleService
|
||||
OIDCIss string
|
||||
logger log.Logger
|
||||
@@ -36,7 +38,7 @@ type accountsServiceBackend struct {
|
||||
}
|
||||
|
||||
func (a accountsServiceBackend) GetUserByClaims(ctx context.Context, claim, value string, withRoles bool) (*cs3.User, string, error) {
|
||||
var account *accounts.Account
|
||||
var account *accountsmsg.Account
|
||||
var status int
|
||||
var query string
|
||||
|
||||
@@ -109,8 +111,8 @@ func (a *accountsServiceBackend) Authenticate(ctx context.Context, username stri
|
||||
}
|
||||
|
||||
func (a accountsServiceBackend) CreateUserFromClaims(ctx context.Context, claims map[string]interface{}) (*cs3.User, error) {
|
||||
req := &accounts.CreateAccountRequest{
|
||||
Account: &accounts.Account{
|
||||
req := &accountssvc.CreateAccountRequest{
|
||||
Account: &accountsmsg.Account{
|
||||
CreationType: "LocalAccount",
|
||||
AccountEnabled: true,
|
||||
},
|
||||
@@ -155,7 +157,7 @@ func (a accountsServiceBackend) GetUserGroups(ctx context.Context, userID string
|
||||
|
||||
// accountToUser converts an owncloud account struct to a reva user struct. In the proxy
|
||||
// we work with the reva struct as a token can be minted from it.
|
||||
func (a *accountsServiceBackend) accountToUser(account *accounts.Account) *cs3.User {
|
||||
func (a *accountsServiceBackend) accountToUser(account *accountsmsg.Account) *cs3.User {
|
||||
user := &cs3.User{
|
||||
Id: &cs3.UserId{
|
||||
OpaqueId: account.Id,
|
||||
@@ -173,8 +175,8 @@ func (a *accountsServiceBackend) accountToUser(account *accounts.Account) *cs3.U
|
||||
return user
|
||||
}
|
||||
|
||||
func (a *accountsServiceBackend) getAccount(ctx context.Context, query string) (account *accounts.Account, status int) {
|
||||
resp, err := a.accountsClient.ListAccounts(ctx, &accounts.ListAccountsRequest{
|
||||
func (a *accountsServiceBackend) getAccount(ctx context.Context, query string) (account *accountsmsg.Account, status int) {
|
||||
resp, err := a.accountsClient.ListAccounts(ctx, &accountssvc.ListAccountsRequest{
|
||||
Query: query,
|
||||
PageSize: 2,
|
||||
})
|
||||
@@ -216,7 +218,7 @@ func (a *accountsServiceBackend) generateToken(ctx context.Context, u *cs3.User)
|
||||
return token, nil
|
||||
}
|
||||
|
||||
func expandGroups(account *accounts.Account) []string {
|
||||
func expandGroups(account *accountsmsg.Account) []string {
|
||||
groups := make([]string, len(account.MemberOf))
|
||||
for i := range account.MemberOf {
|
||||
// reva needs the unix group name
|
||||
|
||||
Reference in New Issue
Block a user