Conch API

Logo

Datacenter build and management service

View the Project on GitHub joyent/conch-api

Conch::Plugin::AuthHelpers

SOURCE

https://github.com/joyent/conch-api/blob/master/lib/Conch/Plugin/AuthHelpers.pm

METHODS

register

Sets up all convenience handlers for authentication.

HELPERS

These methods are made available on the $c object (the invocant of all controller methods, and therefore other helpers).

is_system_admin

return $c->status(403) if not $c->is_system_admin;

Verifies that the currently stashed user has the is_admin flag set.

generate_jwt

Generates a session token for the specified user and stores it in the database. Returns the new row and the JWT.

expires is an epoch time.

generate_jwt_from_token

Given a session token, generate a JWT for it.

LICENSING

Copyright Joyent, Inc.

This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://www.mozilla.org/en-US/MPL/2.0/.