diff --git a/cluster/cluster.go b/cluster/cluster.go index 3f4bcc2c..b85bed84 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -14,6 +14,7 @@ import ( apiclient "github.com/datarhei/core/v16/cluster/client" "github.com/datarhei/core/v16/cluster/forwarder" clusteriam "github.com/datarhei/core/v16/cluster/iam" + clusteriamadapter "github.com/datarhei/core/v16/cluster/iam/adapter" "github.com/datarhei/core/v16/cluster/proxy" "github.com/datarhei/core/v16/cluster/raft" "github.com/datarhei/core/v16/cluster/store" @@ -758,12 +759,12 @@ func (c *cluster) SetProcessMetadata(origin string, id app.ProcessID, key string } func (c *cluster) IAM(superuser iamidentity.User, jwtRealm, jwtSecret string) (iam.IAM, error) { - policyAdapter, err := clusteriam.NewPolicyAdapter(c.store) + policyAdapter, err := clusteriamadapter.NewPolicyAdapter(c.store) if err != nil { return nil, fmt.Errorf("cluster policy adapter: %w", err) } - identityAdapter, err := clusteriam.NewIdentityAdapter(c.store) + identityAdapter, err := clusteriamadapter.NewIdentityAdapter(c.store) if err != nil { return nil, fmt.Errorf("cluster identitry adapter: %w", err) } diff --git a/cluster/iam/adapter/identity.go b/cluster/iam/adapter/identity.go new file mode 100644 index 00000000..2026e8de --- /dev/null +++ b/cluster/iam/adapter/identity.go @@ -0,0 +1,28 @@ +package adapter + +import ( + "github.com/datarhei/core/v16/cluster/store" + iamidentity "github.com/datarhei/core/v16/iam/identity" +) + +type identityAdapter struct { + store store.Store +} + +func NewIdentityAdapter(store store.Store) (iamidentity.Adapter, error) { + a := &identityAdapter{ + store: store, + } + + return a, nil +} + +func (a *identityAdapter) LoadIdentities() ([]iamidentity.User, error) { + users := a.store.UserList() + + return users.Users, nil +} + +func (a *identityAdapter) SaveIdentities([]iamidentity.User) error { + return nil +} diff --git a/cluster/iam/adapter.go b/cluster/iam/adapter/policy.go similarity index 79% rename from cluster/iam/adapter.go rename to cluster/iam/adapter/policy.go index d8753a8c..2f7b28ad 100644 --- a/cluster/iam/adapter.go +++ b/cluster/iam/adapter/policy.go @@ -1,4 +1,4 @@ -package iam +package adapter import ( "strings" @@ -6,7 +6,6 @@ import ( "github.com/datarhei/core/v16/cluster/store" iamaccess "github.com/datarhei/core/v16/iam/access" - iamidentity "github.com/datarhei/core/v16/iam/identity" "github.com/casbin/casbin/v2/model" ) @@ -101,25 +100,3 @@ func (a *policyAdapter) HasDomain(name string) bool { return ok } - -type identityAdapter struct { - store store.Store -} - -func NewIdentityAdapter(store store.Store) (iamidentity.Adapter, error) { - a := &identityAdapter{ - store: store, - } - - return a, nil -} - -func (a *identityAdapter) LoadIdentities() ([]iamidentity.User, error) { - users := a.store.UserList() - - return users.Users, nil -} - -func (a *identityAdapter) SaveIdentities([]iamidentity.User) error { - return nil -}