Updates to Stormpath as per Randall Degges

This commit is contained in:
Joseph Hall 2015-04-22 15:59:09 -06:00
parent 3b17858052
commit 2a4ef7ce3b
2 changed files with 19 additions and 12 deletions

View File

@ -2,8 +2,9 @@
Using Salt with Stormpath
=========================
Stormpath is a user management and authentication service. This tutorial covers
using SaltStack to manage and take advantage of Stormpath's features.
`Stormpath <https://stormpath.com/>`_ is a user management and authentication
service. This tutorial covers using SaltStack to manage and take advantage of
Stormpath's features.
External Authentication
-----------------------
@ -18,6 +19,10 @@ of the ``application`` that is associated with the users to be authenticated:
apikey: FEFREF43t3FEFRe/f323fwer4FWF3445gferWRWEer1
application: 786786FREFrefreg435fr1
.. note::
These values can be found in the `Stormpath dashboard
<https://api.stormpath.com/ui2/index.html#/>`_`.
Users that are to be authenticated should be set up under the ``stormpath``
dict under ``external_auth``:
@ -45,18 +50,12 @@ order to use either, a minion must be configured with an API ID and key.
stormpath:
apiid: 367DFSF4FRJ8767FSF4G34FGH
apikey: FEFREF43t3FEFRe/f323fwer4FWF3445gferWRWEer1
tenantid: ffwEWFEW3443GERG34greG
directory: efreg435fr1786786FREFr
application: 786786FREFrefreg435fr1
Some functions in the ``stormpath`` modules can make use of other options. The
following options are also available.
tenantid
````````
The ID of the tenant is required for some functions to work properly. For
instance, it is used with the ``stormpath.list_directories`` function.
directory
`````````
The ID of the directory that is to be used with this minion. Many functions
@ -153,8 +152,7 @@ Delete an account from Stormpath.
stormpath.list_directories
``````````````````````````
Show all directories. A ``tenantid`` must be specified in the minion's
configuration in order for this function to work.
Show all directories associated with this tenant.
.. code-block:: bash

View File

@ -175,8 +175,17 @@ def list_directories():
.. versionadded:: Beryllium
'''
tenant = __opts__.get('stormpath', {}).get('tenantid', None)
status, result = _query(action='tenants', command='{0}/directories'.format(tenant))
tenant = show_tenant()
tenant_id = tenant.get('href', '').split('/')[-1]
status, result = _query(action='tenants', command='{0}/directories'.format(tenant_id))
return result
def show_tenant():
'''
Get the tenant for the login being used
'''
status, result = _query(action='tenants', command='current')
return result