The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Etcd::Auth

DESCRIPTION

Authentication

SYNOPSIS

Steps to enable authentication.

    # add user
    $etcd->user({ name => 'root', password => 'toor' })->add;

    # add role
    $etcd->role({ name => 'root' })->add;

    # grant role
    $etcd->user_role({ user => 'root', role => 'root' })->grant;

    # enable auth
    $etcd->auth()->enable;

endpoint

name

Defaults to $etcd->name

password

Defaults to $etcd->password

PUBLIC METHODS

authenticate

Returns token with valid authentication. The token must then be passed in the Authorization header. The module handles passing, storing and refreshing of the token for you as long as you define a name and password.

    # authenticate etcd as root
    $etcd = Net::Etcd->new({ name => 'root', password => 'toor' });

    # switch to non root user
    $etcd->auth({ name => $user, password => $pass })->authenticate;

enable

Enable authentication.

    $etcd->auth()->enable;

disable

Disable authentication, this requires a valid root password.

    $etcd->auth({ name => 'root', password => $pass })->disable;