Revision 26498848
b/astakosclient/astakosclient/tests.py | ||
---|---|---|
341 | 341 |
|
342 | 342 |
# ---------------------------- |
343 | 343 |
# Local users |
344 |
token_1 = "skzleaFlBl+fasFdaf24sx=="
|
|
344 |
token_1 = "skzleaFlBl+fasFdaf24sx" |
|
345 | 345 |
user_1 = \ |
346 | 346 |
{"username": "user1@example.com", |
347 | 347 |
"auth_token_created": 1359386939000, |
... | ... | |
370 | 370 |
"display_name": "Storage Space", |
371 | 371 |
"name": "pithos+.diskspace"}]} |
372 | 372 |
|
373 |
token_2 = "fasdfDSFdf98923DF+sdfk=="
|
|
373 |
token_2 = "fasdfDSFdf98923DF+sdfk" |
|
374 | 374 |
user_2 = \ |
375 | 375 |
{"username": "user2@example.com", |
376 | 376 |
"auth_token_created": 1358386938997, |
... | ... | |
581 | 581 |
# ---------------------------------- |
582 | 582 |
# Test the response we get if we send invalid token |
583 | 583 |
def _invalid_token(self, pool): |
584 |
token = "skaksaFlBl+fasFdaf24sx=="
|
|
584 |
token = "skaksaFlBl+fasFdaf24sx" |
|
585 | 585 |
_mock_request([_request_ok]) |
586 | 586 |
try: |
587 | 587 |
client = AstakosClient("https://example.com", use_pool=pool) |
... | ... | |
737 | 737 |
# ---------------------------------- |
738 | 738 |
# Test the response we get for invalid token |
739 | 739 |
def _invalid_token(self, pool): |
740 |
token = "skaksaFlBl+fasFdaf24sx=="
|
|
740 |
token = "skaksaFlBl+fasFdaf24sx" |
|
741 | 741 |
_mock_request([_request_ok]) |
742 | 742 |
try: |
743 | 743 |
client = AstakosClient("https://example.com", use_pool=pool) |
... | ... | |
824 | 824 |
def test_invalid_token(self): |
825 | 825 |
"""Test the response we get for invalid token (without pool)""" |
826 | 826 |
global user_1 |
827 |
token = "skaksaFlBl+fasFdaf24sx=="
|
|
827 |
token = "skaksaFlBl+fasFdaf24sx" |
|
828 | 828 |
_mock_request([_request_ok]) |
829 | 829 |
try: |
830 | 830 |
client = AstakosClient("https://example.com") |
... | ... | |
889 | 889 |
def test_invalid_token(self): |
890 | 890 |
"""Test the response we get for invalid token (using pool)""" |
891 | 891 |
global user_1 |
892 |
token = "skaksaFlBl+fasFdaf24sx=="
|
|
892 |
token = "skaksaFlBl+fasFdaf24sx" |
|
893 | 893 |
_mock_request([_request_ok]) |
894 | 894 |
try: |
895 | 895 |
client = AstakosClient("https://example.com") |
b/astakosclient/docs/index.rst | ||
---|---|---|
39 | 39 |
from astakosclient import AstakosClient |
40 | 40 |
|
41 | 41 |
client = AstakosClient("https://accounts.example.com") |
42 |
user_info = client.get_user_info("UQpYas7ElzWGD5yCcEXtjw==")
|
|
42 |
user_info = client.get_user_info("UQpYas7ElzWGD5yCcEXtjw") |
|
43 | 43 |
print user_info['username'] |
44 | 44 |
|
45 | 45 |
Another example where we ask for the username of a user with UUID: |
... | ... | |
50 | 50 |
from astakosclient import AstakosClient |
51 | 51 |
|
52 | 52 |
client = AstakosClient("https://accounts.example.com") |
53 |
username = client.get_username("UQpYas7ElzWGD5yCcEXtjw==",
|
|
53 |
username = client.get_username("UQpYas7ElzWGD5yCcEXtjw", |
|
54 | 54 |
"b3de8eb0-3958-477e-als9-789af8dd352c") |
55 | 55 |
print username |
56 | 56 |
|
b/docs/astakos-api-guide.rst | ||
---|---|---|
330 | 330 |
{ |
331 | 331 |
"auth":{ |
332 | 332 |
"token":{ |
333 |
"id":"CDEe2k0T/HdiJWBMMbHyOA=="
|
|
333 |
"id":"CDEe2k0T/HdiJWBMMbHyOA" |
|
334 | 334 |
}, |
335 | 335 |
"tenantName":"c18088be-16b1-4263-8180-043c54e22903" |
336 | 336 |
} |
... | ... | |
344 | 344 |
"auth":{ |
345 | 345 |
"passwordCredentials":{ |
346 | 346 |
"username":"c18088be-16b1-4263-8180-043c54e22903", |
347 |
"password":"CDEe2k0T/HdiJWBMMbHyOA=="
|
|
347 |
"password":"CDEe2k0T/HdiJWBMMbHyOA" |
|
348 | 348 |
}, |
349 | 349 |
"tenantName":"c18088be-16b1-4263-8180-043c54e22903" |
350 | 350 |
} |
... | ... | |
406 | 406 |
"type": "identity"}], |
407 | 407 |
"token": { |
408 | 408 |
"expires": "2013-06-19T15:23:59.975572+00:00", |
409 |
"id": "CDEe2k0T/HdiJWBMMbHyOA==",
|
|
409 |
"id": "CDEe2k0T/HdiJWBMMbHyOA", |
|
410 | 410 |
"tenant": {"id": "c18088be-16b1-4263-8180-043c54e22903", |
411 | 411 |
"name": "Firstname Lastname"}}, |
412 | 412 |
"user": { |
... | ... | |
423 | 423 |
|
424 | 424 |
<access xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
425 | 425 |
xmlns="http://docs.openstack.org/identity/api/v2.0"> |
426 |
<token id="CDEe2k0T/HdiJWBMMbHyOA==" expires="2013-06-19T15:23:59.975572+00:00">
|
|
426 |
<token id="CDEe2k0T/HdiJWBMMbHyOA" expires="2013-06-19T15:23:59.975572+00:00"> |
|
427 | 427 |
<tenant id="c18088be-16b1-4263-8180-043c54e22903" name="Firstname Lastname" /> |
428 | 428 |
</token> |
429 | 429 |
<user id="c18088be-16b1-4263-8180-043c54e22903" name="Firstname Lastname"> |
b/docs/quick-install-admin-guide.rst | ||
---|---|---|
867 | 867 |
PITHOS_BACKEND_DB_CONNECTION = 'postgresql://synnefo:example_passw0rd@node1.example.com:5432/snf_pithos' |
868 | 868 |
PITHOS_BACKEND_BLOCK_PATH = '/srv/pithos/data' |
869 | 869 |
|
870 |
PITHOS_SERVICE_TOKEN = 'pithos_service_token22w=='
|
|
870 |
PITHOS_SERVICE_TOKEN = 'pithos_service_token22w' |
|
871 | 871 |
|
872 | 872 |
# Set to False if astakos & pithos are on the same host |
873 | 873 |
#PITHOS_PROXY_USER_SERVICES = True |
... | ... | |
1707 | 1707 |
# Set to False if astakos & cyclades are on the same host |
1708 | 1708 |
CYCLADES_PROXY_USER_SERVICES = False |
1709 | 1709 |
|
1710 |
CYCLADES_SERVICE_TOKEN = 'cyclades_service_token22w=='
|
|
1710 |
CYCLADES_SERVICE_TOKEN = 'cyclades_service_token22w' |
|
1711 | 1711 |
|
1712 | 1712 |
The ``ASTAKOS_BASE_URL`` denotes the Astakos endpoint for Cyclades, |
1713 | 1713 |
which is used for all user management, including authentication. |
b/snf-astakos-app/astakos/im/models.py | ||
---|---|---|
95 | 95 |
|
96 | 96 |
def generate_token(): |
97 | 97 |
s = os.urandom(32) |
98 |
return base64.urlsafe_b64encode(s) |
|
98 |
return base64.urlsafe_b64encode(s).rstrip('=')
|
|
99 | 99 |
|
100 | 100 |
|
101 | 101 |
class Component(models.Model): |
Also available in: Unified diff