snap-auth-cli: Command-line tool to manage Snap AuthManager database

[ bsd3, program, snap, web ] [ Propose Tags ]

This utility provides command-line interface to user database of standard authentication system for the Snap web framework. You can create, read and update users, set passwords, roles and meta information. Currently only JsonFile backend is supported. Type `snap-auth-cli -?` to get usage information, or see README.md for details.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.2
Change log CHANGELOG.md
Dependencies aeson (<1.2), aeson-pretty (<0.9), base (<5), bytestring (<0.11), clientsession (<0.10), cmdargs (<0.11), snap (<1.1), snaplet-sqlite-simple (<1.1), sqlite-simple (<0.5), text (<1.3), unordered-containers (<0.3), utf8-string (<1.1) [details]
License BSD-3-Clause
Author Dmitry Dzhus
Maintainer dima@dzhus.org
Category Web, Snap
Home page https://github.com/dzhus/snap-auth-cli#readme
Bug tracker https://github.com/dzhus/snap-auth-cli/issues
Source repo head: git clone https://github.com/dzhus/snap-auth-cli
Uploaded by DmitryDzhus at 2018-03-30T13:22:05Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables snap-auth-cli
Downloads 2300 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2018-03-30 [all 3 reports]

Readme for snap-auth-cli-0.2

[back to package description]

snap-auth-cli: CLI tool to manage Snap auth database

Travis CI build status Hackage Hackage deps

This tool provides command-line interface to Haskell Snap AuthManager to create, view and delete users in database. Currently the Json and Sqlite file backends are supported.

Passwords for new users are provided in plain text.

By default the database resides in current directory in users.json file. A different db may be specified using -f flag. To specify a Sqlite database use -s -f filename.

How to use

Type snap-auth-cli --help to get usage help.

Create a user:

$ snap-auth-cli --create -u TwasBrillig -p SlithyToves1855

User roles may be set when creating account using arbitary number of -o flags:

$ snap-auth-cli --create -u TwasBrillig2 -p SlithyToves1855 -o gyre -o gimble

A user may have an arbitary number of key-value pairs attached in the meta field (currently all fields are stored in Strings):

$ snap-auth-cli --create -u AlexP -p 1234 -k number -v 3214 -k foo -v bar -o admin

Read a user from DB (--read flag may be omitted since reading is the default mode):

$ snap-auth-cli --read -u AlexP
{
    "meta": {
        "number": "3214",
        "foo": "bar"
    },
    "suspended_at": null,
    "roles": [
        "admin"
    ],
    "pw": "sha256|12|VpUGBg2O/NBkDTVTSqqYuA==|TIDuc3ToAPmALXCHBxTA8SjlUBztPS8nH6qiV63a+f4=",
    "activated_at": null,
    "current_ip": null,
    "locked_until": null,
    "updated_at": "2012-02-22T09:00:29.377Z",
    "login_count": 0,
    "current_login_at": null,
    "login": "AlexP",
    "remember_token": null,
    "failed_login_count": 0,
    "last_ip": null,
    "last_login_at": null,
    "uid": "1",
    "created_at": null
}

To specify a different database file (Json by default):

$ snap-auth-cli -f back.json --create -u MimsyBorogove -p 0utgr@b3d

Note that if database file doesn't exist, it will be created from scratch.

To specify a Sqlite database:

$ snap-auth-cli -s -f db.sqlite --read -u AlexP

Unlike the Json backend, the database file with the correct schema must aleady exist; this should be automaticallly initialized by when you first run the Snap application.

Existing users can be modified using the -m option. User is selected by login. Any of -p, -o or -k/-v flags may be specified to set new value for user password, roles or meta. If no new value is provided, old field is preserved.

Set a new password for user:

$ snap-auth-cli -m -u Mome -p r@th$$

Set a new role:

$ snap-auth-cli -m -u Mome -o foobarer

Replace user meta:

$ snap-auth-cli -m -u BG -k tel -v 2-12-85-06

The tool provides interface to delete users; the Sqlite backend supports this operation but the JsonFile backend does not.