GithubHelp home page GithubHelp logo

auth_codetest's Introduction

Design & coding test

Architecture

┌────────────────────────────────┐
│ Gateway Layer(skipped          │
│                                │
│   HTTP/Rest etc... skiped      │
│                                │
├────────────────────────────────┤
│ Service Layer: Auth Service    ├─────┐
│            ┌───────────────────┤     │
│            │Session Management:│     │
│            │                   │     │
├────────────┴───────────────────┼─────▼────┐
│ Repo Layer: User/Role Service  │ utils:   │
│                                │          │
│                                │          │
│                                │ Token... │
├────────────────────────────────┤          │
│ Domain Layer: User/Role        │          │
│                                │          │
│                                │          │
│                                │          │
└────────────────────────────────┴──────────┘

Design Considerations & Dependencies

Rich Domain Modeling

  • User.roles --> a set in user
  • token
    • could be invalidated, means: token should be maintained in a stateful collections in serverside
    • could get user from token, means: userName encoded in token

compile scope

  1. gson for serializable
  2. sl4j for logging

test scope

  1. Junit for test
  2. aspectJ(assertThat) for better testing

TDD Test Cases

  1. Util Test(Util Layer)
    1. generate token
    2. parse token
  2. Role Test(Internal Service Layer)
    1. create role
    2. delete role
    3. get role
  3. User Test(Internal Service Layer)
    1. create user
    2. delete user
    3. get user
  4. Auth Test(API Layer)
    1. add role to a user
    2. auth(login) --> get token
    3. invalid --> remove token in session store
    4. get all roles by token
    5. check token & single role
    6. ttl config as parameters of getInstance()

auth_codetest's People

Contributors

yywill avatar

Watchers

 avatar

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.