Skip to content

Commit

Permalink
New auth_methods subdir for organization purposes (#255)
Browse files Browse the repository at this point in the history
* New auth_methods subdir for organization purposes

* Drop AWS/GCP secrets engines placeholder sections

* Less redudant headings
  • Loading branch information
jeffwecan committed Aug 31, 2018
1 parent 6b72e9b commit c0ceb0d
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 71 deletions.
47 changes: 2 additions & 45 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,7 @@ Usage
=====

.. toctree::
:maxdepth: 4
:maxdepth: 2

usage/auth_methods/index
usage/system_backend
usage/token_auth_method
usage/aws
usage/gcp
usage/kubernetes_auth_method
usage/approle_auth_method
usage/ldap
usage/github
usage/mfa


Authenticate to different auth backends
---------------------------------------

.. code:: python
# App ID
client.auth_app_id('MY_APP_ID', 'MY_USER_ID')
# GitHub
client.auth_github('MY_GITHUB_TOKEN')
# TLS
client = Client(cert=('path/to/cert.pem', 'path/to/key.pem'))
client.auth_tls()
# Non-default mount point (available on all auth types)
client.auth_userpass('MY_USERNAME', 'MY_PASSWORD', mount_point='CUSTOM_MOUNT_POINT')
# Authenticating without changing to new token (available on all auth types)
result = client.auth_github('MY_GITHUB_TOKEN', use_token=False)
print(result['auth']['client_token']) # => u'NEW_TOKEN'
# Custom or unsupported auth type
params = {
'username': 'MY_USERNAME',
'password': 'MY_PASSWORD',
'custom_param': 'MY_CUSTOM_PARAM',
}
result = client.auth('/v1/auth/CUSTOM_AUTH/login', json=params)
# Logout
client.logout()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Approle Auth Method
===================
Approle
=======

Authentication
--------------
Expand Down
9 changes: 2 additions & 7 deletions docs/usage/aws.rst → docs/usage/auth_methods/aws.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AWS Authentication Backend
==========================
AWS
===

Authentication
--------------
Expand All @@ -16,8 +16,3 @@ IAM authentication method:
session = boto3.Session()
credentials = session.get_credentials()
client.auth_aws_iam(credentials.access_key, credentials.secret_key, credentials.token)
AWS Secret Backend
==================

To be filled in.
9 changes: 2 additions & 7 deletions docs/usage/gcp.rst → docs/usage/auth_methods/gcp.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GCP Auth Backend
================
GCP
===

Authentication
--------------
Expand All @@ -18,8 +18,3 @@ Authentication
url = 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience={}&format={}'.format(AUDIENCE_URL, FORMAT)
r = requests.get(url, headers=METADATA_HEADERS)
client.auth_gcp(ROLE, r.text)
GCP Secret Backend
==================

To be filled in.
4 changes: 2 additions & 2 deletions docs/usage/github.rst → docs/usage/auth_methods/github.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GitHub Auth Method
==================
GitHub
======

.. note::
Every method under the :py:attr:`Client class's github attribute<hvac.v1.Client.github>` includes a `mount_point` parameter that can be used to address the Github auth method under a custom mount path. E.g., If enabling the Github auth method using Vault's CLI commands via `vault auth enable -path=my-github github`", the `mount_point` parameter in :py:meth:`hvac.api.auth.Github` methods would be set to "my-github".
Expand Down
49 changes: 49 additions & 0 deletions docs/usage/auth_methods/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Auth Methods
============

.. toctree::
:maxdepth: 2

approle
aws
gcp
github
kubernetes
ldap
mfa
token

Authenticate to different auth backends
---------------------------------------

.. code:: python
# App ID
client.auth_app_id('MY_APP_ID', 'MY_USER_ID')
# GitHub
client.auth_github('MY_GITHUB_TOKEN')
# TLS
client = Client(cert=('path/to/cert.pem', 'path/to/key.pem'))
client.auth_tls()
# Non-default mount point (available on all auth types)
client.auth_userpass('MY_USERNAME', 'MY_PASSWORD', mount_point='CUSTOM_MOUNT_POINT')
# Authenticating without changing to new token (available on all auth types)
result = client.auth_github('MY_GITHUB_TOKEN', use_token=False)
print(result['auth']['client_token']) # => u'NEW_TOKEN'
# Custom or unsupported auth type
params = {
'username': 'MY_USERNAME',
'password': 'MY_PASSWORD',
'custom_param': 'MY_CUSTOM_PARAM',
}
result = client.auth('/v1/auth/CUSTOM_AUTH/login', json=params)
# Logout
client.logout()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Kubernetes Auth Backend
=======================
Kubernetes
==========

Authentication
--------------
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/ldap.rst → docs/usage/auth_methods/ldap.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
LDAP Auth Method
================
LDAP
====

.. note::
Every method under the :py:attr:`Client class's ldap attribute<hvac.v1.Client.ldap>` includes a `mount_point` parameter that can be used to address the LDAP auth method under a custom mount path. E.g., If enabling the LDAP auth method using Vault's CLI commands via `vault auth enable -path=my-ldap ldap`", the `mount_point` parameter in :py:meth:`hvac.api.auth.Ldap` methods would be set to "my-ldap".
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/mfa.rst → docs/usage/auth_methods/mfa.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MFA Auth Method
================
MFA
===

Configure MFA Auth Method Settings
-----------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Token Auth Method
=================
Token
=====

Authentication
--------------
Expand Down

0 comments on commit c0ceb0d

Please sign in to comment.