Skip to content

Commit

Permalink
Merge pull request #344 from versity/ben/s3proxy
Browse files Browse the repository at this point in the history
Ben/s3proxy
  • Loading branch information
benmcclelland authored Dec 19, 2023
2 parents f27162b + 3d6e37b commit 6f6af8e
Show file tree
Hide file tree
Showing 4 changed files with 354 additions and 214 deletions.
40 changes: 28 additions & 12 deletions auth/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package auth

import (
"errors"
"fmt"
"time"
)

Expand Down Expand Up @@ -43,18 +44,25 @@ type IAMService interface {
var ErrNoSuchUser = errors.New("user not found")

type Opts struct {
Dir string
LDAPServerURL string
LDAPBindDN string
LDAPPassword string
LDAPQueryBase string
LDAPObjClasses string
LDAPAccessAtr string
LDAPSecretAtr string
LDAPRoleAtr string
CacheDisable bool
CacheTTL int
CachePrune int
Dir string
LDAPServerURL string
LDAPBindDN string
LDAPPassword string
LDAPQueryBase string
LDAPObjClasses string
LDAPAccessAtr string
LDAPSecretAtr string
LDAPRoleAtr string
S3Access string
S3Secret string
S3Region string
S3Bucket string
S3Endpoint string
S3DisableSSlVerfiy bool
S3Debug bool
CacheDisable bool
CacheTTL int
CachePrune int
}

func New(o *Opts) (IAMService, error) {
Expand All @@ -64,12 +72,20 @@ func New(o *Opts) (IAMService, error) {
switch {
case o.Dir != "":
svc, err = NewInternal(o.Dir)
fmt.Printf("initializing internal IAM with %q\n", o.Dir)
case o.LDAPServerURL != "":
svc, err = NewLDAPService(o.LDAPServerURL, o.LDAPBindDN, o.LDAPPassword,
o.LDAPQueryBase, o.LDAPAccessAtr, o.LDAPSecretAtr, o.LDAPRoleAtr,
o.LDAPObjClasses)
fmt.Printf("initializing LDAP IAM with %q\n", o.LDAPServerURL)
case o.S3Endpoint != "":
svc, err = NewS3(o.S3Access, o.S3Secret, o.S3Region, o.S3Bucket,
o.S3Endpoint, o.S3DisableSSlVerfiy, o.S3Debug)
fmt.Printf("initializing S3 IAM with '%v/%v'\n",
o.S3Endpoint, o.S3Bucket)
default:
// if no iam options selected, default to the single user mode
fmt.Println("No IAM service configured, enabling single account mode")
return IAMServiceSingle{}, nil
}

Expand Down
177 changes: 0 additions & 177 deletions auth/iam_proxy.go

This file was deleted.

Loading

0 comments on commit 6f6af8e

Please sign in to comment.