pypicloud.auth module

Utilities for authentication and authorization

class pypicloud.auth.PypicloudSecurityPolicy[source]

Bases: object

authenticated_userid(request)[source]

Return a userid string identifying the trusted and verified user, or None if unauthenticated.

If the result is None, then pyramid.request.Request.is_authenticated will return False.

forget(request, **kw)[source]

Return a set of headers suitable for ‘forgetting’ the current user on subsequent requests. An individual security policy and its consumers can decide on the composition and meaning of **kw.

identity(request)[source]

Return the identity of the current user. The object can be of any shape, such as a simple ID string or an ORM object.

permits(request, context, permission)[source]

Return an instance of pyramid.security.Allowed if a user of the given identity is allowed the permission in the current context, else return an instance of pyramid.security.Denied.

remember(request, userid, **kw)[source]

Return a set of headers suitable for ‘remembering’ the userid named userid when set in a response. An individual security policy and its consumers can decide on the composition and meaning of **kw.

pypicloud.auth.get_basicauth_credentials(request)[source]

Get the user/password from HTTP basic auth

pypicloud.auth.includeme(config)[source]

Configure the app