GithubHelp home page GithubHelp logo

ncrashed / servant-auth-token-api Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 3.0 838 KB

Servant based API for token based authorisation

License: BSD 3-Clause "New" or "Revised" License

Haskell 95.68% Nix 3.31% Shell 1.00%

servant-auth-token-api's Introduction

servant-auth-token-api

Build Status

The package provides abstract RESTful API for token based authorisation using servant. It contains only generic types and servant-swagger instances. You may be interested in server/client side implementations:

Also you can explore swagger documentation for the API and view markdown version of docs.

servant-auth-token-api's People

Contributors

hughjfchen avatar ivan-m avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

servant-auth-token-api's Issues

How should signup flow look from the client side?

Hi. I wanted to use this lib in my web app written in servant.

Everything seems straightforward, but I have trouble implementing client side flow for first sign-up of new user. In order to call POST AuthSignupMethod, current api requires me to already have a token for user with registerPerm. So how this unregistered user is supposed to obtain such token? Should every anonymous user be logged on the start of application as some kind of special account that has only permission to use public APIs and register new users?

Is it a bad practice to build an endpoint that simply allows anyone to register, without the need for any kind of token?

Should AuthSigninMethod use Post?

Currently, there is:

type AuthSigninMethod 
    = "auth" :> "signin" 
        :> QueryParam "login" Login 
        :> QueryParam "password" Password 
        :> QueryParam "expire" Seconds
        :> Get '[JSON] (OnlyField "token" SimpleToken)

However, this means that any parameters will appear in the resulting URL. As such, they can appear in server logs, etc.

If, however, Post is used (as is the case with AuthSigninPostCodeMethod) then these parameters will not appear in logs, usernames and passwords can be longer, and if for some reason someone tries to call one in a browser then credentials won't be found in the history and the call won't be cached.

As another point, Get is typically used for idempotent requests, whereas each time you sign in you should expect a new token; as such, from a conceptual point of view I don't think it aligns well anyway.

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.