Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
IljaN committed Dec 7, 2020
1 parent d6114ef commit f4e8d19
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion proxy/pkg/middleware/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TokenCacheTTL(ttl time.Duration) Option {
}
}

// TokenCacheTTL provides a function to set the TokenCacheTTL
// UserProvider sets the accounts user provider
func UserProvider(up provider.UserProvider) Option {
return func(o *Options) {
o.UserProvider = up
Expand Down
14 changes: 9 additions & 5 deletions proxy/pkg/provider/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ import (
"strings"
)

// UserProvider allows the proxy to retrieve users from different user-backends (accounts-service, CS3)
type UserProvider interface {
GetUserByClaims(ctx context.Context, claim, value string, withRoles bool) (*cs3.User, error)
Authenticate(ctx context.Context, username string, password string) (*cs3.User, error)
GetUserGroups(ctx context.Context, userId string)
GetUserGroups(ctx context.Context, userID string)
}

// RevaAuthenticator helper interface to mock auth-method from reva gateway-client.
type RevaAuthenticator interface {
Authenticate(ctx context.Context, in *gateway.AuthenticateRequest, opts ...grpc.CallOption) (*gateway.AuthenticateResponse, error)
}

// NewCS3UserProvider creates a user-provider which fetches users from a CS3 Backend
func NewCS3UserProvider(up revaUser.UserAPIClient, rs settings.RoleService, ap RevaAuthenticator) UserProvider {
return &cs3provider{
userProvider: up,
Expand Down Expand Up @@ -99,10 +102,11 @@ func (c *cs3provider) Authenticate(ctx context.Context, username string, passwor
return res.User, nil
}

func (c cs3provider) GetUserGroups(ctx context.Context, userId string) {
func (c cs3provider) GetUserGroups(ctx context.Context, userID string) {
panic("implement me")
}

// NewAccountsServiceProvider creates a user-provider which fetches users from the ocis accounts-service
func NewAccountsServiceProvider(ac accounts.AccountsService, rs settings.RoleService, oidcISS string) UserProvider {
return &accountsServiceProvider{
accountsClient: ac,
Expand Down Expand Up @@ -215,7 +219,7 @@ func (a *accountsServiceProvider) Authenticate(ctx context.Context, username str
return user, nil
}

func (a accountsServiceProvider) GetUserGroups(ctx context.Context, userId string) {
func (a accountsServiceProvider) GetUserGroups(ctx context.Context, userID string) {
panic("implement me")
}

Expand Down Expand Up @@ -273,8 +277,8 @@ func lazyLoadRoles(ctx context.Context, u *cs3.User, ss settings.RoleService) er

}

func loadRolesIDs(ctx context.Context, opaqueUserId string, rs settings.RoleService) ([]string, error) {
req := &settings.ListRoleAssignmentsRequest{AccountUuid: opaqueUserId}
func loadRolesIDs(ctx context.Context, opaqueUserID string, rs settings.RoleService) ([]string, error) {
req := &settings.ListRoleAssignmentsRequest{AccountUuid: opaqueUserID}
assignmentResponse, err := rs.ListRoleAssignments(ctx, req)

if err != nil {
Expand Down

0 comments on commit f4e8d19

Please sign in to comment.