OPSI.web2.auth.wrapper module

Wrapper Resources for rfc2617 HTTP Auth.

class OPSI.web2.auth.wrapper.HTTPAuthResource(wrappedResource, credentialFactories, portal, interfaces)

Bases: object

I wrap a resource to prevent it being accessed unless the authentication can be completed using the credential factory, portal, and interfaces specified.

authenticate(request)

Attempt to authenticate the givin request

@param request: An L{IRequest} to be authenticated.

locateChild(request, seg)

Authenticate the request then return the C{self.wrappedResource} and the unmodified segments.

login(factory, response, request)
@param factory: An L{ICredentialFactory} that understands the given
response.

@param response: The client’s authentication response as a string.

@param request: The request that prompted this authentication attempt.

@return: A L{Deferred} that fires with the wrappedResource on success
or a failure containing an L{UnauthorizedResponse}
renderHTTP(request)

Authenticate the request then return the result of calling renderHTTP on C{self.wrappedResource}

class OPSI.web2.auth.wrapper.UnauthorizedResponse(factories, remoteAddr=None)

Bases: OPSI.web2.http.StatusResponse

A specialized response class for generating www-authenticate headers from the given L{CredentialFactory} instances