Package twisted :: Package cred :: Module identity :: Class Identity

[frames | no frames]

## Class Identity

Known Subclasses:
  `ConchIdentity`

An identity, with different methods for verification.

An identity represents a user's permissions with a particular application. It is a username, a password, and a collection of Perspective/Service name pairs, each of which is a perspective that this identity is allowed to access.

Method Summary
| ``__init__`(self, name, authorizer)` Create an identity.
| `__repr__(self)`
| ``addKeyByString`(self, serviceName, perspectiveName)` Put a key on my keyring.
| ``addKeyForPerspective`(self, perspective)` Add a key for the given perspective.
| ``challenge`(self)` I return some random data.
| ``getAllKeys`(self)` Returns a list of all services and perspectives this identity can connect to.
| ``removeKey`(self, serviceName, perspectiveName)` Remove a key from my keyring.
| ``requestPerspectiveForKey`(self, serviceName, perspectiveName)` Get a perspective request (a Deferred) for the given key.
| ``requestPerspectiveForService`(self, serviceName)` Get the first available perspective for a given service.
| ``save`(self)` Persist this Identity to the authorizer.
| ``setAlreadyHashedPassword`(self, cyphertext)` (legacy) Set a password for this identity, already md5 hashed.
| `setPassword(self, plaintext)`
| `upgradeToVersion2(self)`
| ``verifyPassword`(self, challenge, hashedPassword)` Verify a challenge/response password.
| ``verifyPlainPassword`(self, plaintext)` Verify plain text password.

Class Variable Summary
`NoneType` | `hashedPassword` = None

Method Details

### __init__(self, name, authorizer)
(Constructor)

Create an identity.

I must have a name, and a backreference to the Application that the Keys on my keyring make reference to.

### addKeyByString(self, serviceName, perspectiveName)

Put a key on my keyring.

This key will give me a token to access to some service in the future.

### addKeyForPerspective(self, perspective)

Add a key for the given perspective.

### challenge(self)

I return some random data.

This is a method in addition to the module-level function because it is anticipated that we will want to change this to store salted passwords.

### getAllKeys(self)

Returns a list of all services and perspectives this identity can connect to.

This returns a sequence of keys.

### removeKey(self, serviceName, perspectiveName)

Remove a key from my keyring.

If this key is not present, raise KeyError.

### requestPerspectiveForKey(self, serviceName, perspectiveName)

Get a perspective request (a Deferred) for the given key.

If this identity does not have access to the given `(serviceName, perspectiveName)` pair, I will raise `KeyNotFound`.

### requestPerspectiveForService(self, serviceName)

Get the first available perspective for a given service.

### save(self)

Persist this Identity to the authorizer.

### setAlreadyHashedPassword(self, cyphertext)

(legacy) Set a password for this identity, already md5 hashed.

### verifyPassword(self, challenge, hashedPassword)

Verify a challenge/response password.

### verifyPlainPassword(self, plaintext)

Verify plain text password.

This is insecure, but necessary to support legacy protocols such as IRC, POP3, HTTP, etc.

Class Variable Details

### hashedPassword

  Type:
    `NoneType`
  Value:

        None

Generated by Epydoc 2.0 on Sat May 15 20:07:52 2004 | http://epydoc.sf.net