Revision 11366070 snf-astakos-app/astakos/api/tokens.py

b/snf-astakos-app/astakos/api/tokens.py
68 68
                token_id = req['auth']['passwordCredentials']['password']
69 69
                uuid = req['auth']['passwordCredentials']['username']
70 70
            except KeyError:
71
                raise faults.BadRequest('Malformed request')
71
                raise faults.BadRequest(
72
                    'Malformed request: missing credentials')
73

  
74
        tenant = req['auth'].get('tenantName')
72 75

  
73 76
        if token_id is None:
74
            raise faults.BadRequest('Malformed request')
77
            raise faults.BadRequest('Malformed request: missing token')
75 78

  
76 79
        try:
77 80
            user = AstakosUser.objects.get(auth_token=token_id)
......
84 87
            if user.uuid != uuid:
85 88
                raise faults.Unauthorized('Invalid credentials')
86 89

  
90
        if tenant is not None:
91
            if user.uuid != tenant:
92
                raise faults.BadRequest('Not conforming tenantName')
93

  
87 94
        d["access"]["token"] = {
88 95
            "id": user.auth_token,
89 96
            "expires": utils.isoformat(user.auth_token_expires),

Also available in: Unified diff