Giter Site home page Giter Site logo

nefarioustim / cerberus-auth Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 289 KB

Cerberus is an authentication and authorisation microservice, built with Python.

License: GNU General Public License v3.0

Dockerfile 0.54% Python 92.40% Makefile 1.05% Shell 6.01%
authentication authorisation microservice python3 docker

cerberus-auth's People

Contributors

dependabot[bot] avatar nefarioustim avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

lorenzojlamas

cerberus-auth's Issues

Provide clean Python API

The Python API for Cerberus should provide a simple, predictable interface:

import cerberusauth

cerberus = cerberusauth.cerberus()
new_users = cerberus.registration.register_users({"email": "[email protected]"})

Create internal models

Definition

Create internal models for:

  • User
  • Role
  • Permission

Expected columns for models are as follows:

  • User
    • email (required)
    • password_hash (required, derived)
    • fullname (required)
  • Role
    • name (required)
    • description
    • enabled
  • Permission
    • slug (required)
    • description
    • enabled

User.password_hash will be derived from a passed-in password string at point of creation.

Acceptance Criteria

  • All models must contain created and modified UTC datetime fields.
  • All models must contain an ID column, which will be generated on passing to storage.

Create a Repository object for User models

A Repository object should implement CRUD actions for a model. The UserRepository should do this for User models.

UserRepository should have the following methods:

  • save for saving models.
  • delete for deleting models.
  • get for getting individual models.
  • count for counting stored models.

Repository objects should also allow batch actions.

Add an Authorise object.

As a user
I want a wrapper object for authorisation commands
So that my interface is intuitively grouped

Add a soft delete flag on models

All models should include a soft delete flag, so that deletes can be processed at a later date, allowing for a temporary period where undo is possible.

Add a RegisterUsersCommand object.

Add a RegisterUsersCommand object that creates and stores a new User aggregate root. Should also be capable of storing multiple users.

Should expect user data to be passed in as dictionaries, and will only process valid dictionaries that contain an "email" key.

Add a logging handler to the service

The service should include a standard Python logging instance, in order to allow various levels of logging throughout the service code.

Acceptance criteria:

  • Allow logging instance to be functionally summoned, in order to avoid issues with modules, import context, and clashing logging instances.
  • Provide logging configuration through a YAML file, whose location can be overridden from an ENV variable.
    • Will require inclusion of pyyaml dependency.
    • Ensure configuration allows control of what and where.

Convert to nameko service.

As a developer
I want CerberusAuth to be a nameko service
So that I can utilise the nameko microservice structure and extensions for access

Register a new User

As a service consumer
I want to be able to register new Users
So that I can provide user-specific auth

Use Conda build for ReadTheDocs

In order for proper API documentation to be generated, ReadTheDocs will need BCrypt and SQLAlchemy dependencies installed, which requires a conda build.

Create a Repository object for Role models

A Repository object should implement CRUD actions for a model. The RoleRepository should do this for Role models.

RoleRepository should have the following methods:

  • save for saving models.
  • delete for deleting models.
  • get for getting individual models.
  • count for counting stored models.

Repository objects should also allow batch actions.

Create relationships between models

Provide many-to-many relationships between User and Role, and Role and Permission. This should provide a means of accessing and managing children and parents.

Add an Authenticate object.

As a user
I want a wrapper object for authentication commands
So that my interface is intuitively grouped

Create RepositoryAdapter SQLAlchemy

Create a RepositoryAdapter object specifically for SQLAlchemy.

SQLRepositoryAdapter will need to:

  • Inherit from the RepositoryAdapterInterface.
  • Implement all the methods from RepositoryAdapterInteface.
  • Update entity or aggregate root with stored ID when relevant.

Create a Repository object for Permission models

A Repository object should implement CRUD actions for a model. The PermissionRepository should do this for Permission models.

PermissionRepository should have the following methods:

  • save for saving models.
  • delete for deleting models.
  • get for getting individual models.
  • count for counting stored models.

Repository objects should also allow batch actions. This means the above methods should be able to take parameters representing multiple models.

Create SQLAlchemy model derivatives

Create derivatives of internal models specifically for SQLAlchemy.

Models will need to override object attributes with Column definitions.

Prepopulate datastore schema

In order to store models, they should be converted into a datastore schema.

The scripts used to create a schema should be triggered using the correct storage strategy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.