exasol / bucketfs-python

BucketFS utilities for the Python programming language
https://exasol.github.io/bucketfs-python
MIT License
1 stars 1 forks source link

✨ Add better credentails support to new BucketFs API #75

Open Nicoretti opened 11 months ago

Nicoretti commented 11 months ago

Summary

Be more explicit and secure on how credentials are used within the bucketfs api.

Replace the default dict in dict credentials mapping passed to the service with a more sophisticated credentials provider, which e.g. does not accidentally leak authentication information when printing it. Additionally provide more context that credentials are mapped to specific buckets.

Details

Examples / Ideas

Secure & Unsecure Output

credentials = Credentials(username='foo', password='bar')

>>> print(credentials)
Credentials(username: ****, password: ****)

>>> print(f'{credentails:unsecure}')
Credentials(username: foo, password: bar)

Global Credentails Store

store = CredentailStore(
      [
          BucketCredentails(bucket='default', username='user', password='pw'),
          BucketCredentails(bucket='myudfs', username='u', password='secret'),
          ...
     ]
)

store = CredentailStore(
      [
          { 'bucket': 'default', 'username': 'user', 'password': 'pw' },
          { 'bucket': 'myudfs', 'username': 'u', 'password': 'secret' },
          ...
     ]
)

store = credentails.Store(
      [
          credentials.Bucket(name='default', username='user', password='pw'),
          credentails.Bucket(name='myudfs', username='u', password='secret'),
          ...
     ]
)

New Usage

from exasol.bucketfs import Service
from exasol.bucketfs import credentails 

URL = "http://127.0.0.1:1234/"
STORE = credentails.Store(
    credentials.Bucket('default', username='w', password='w')
)
bucketfs = Service(URL, STORE)

Notes

Tasks