Class: OpenID::BaseAssociationManager

### Home Classes Methods

### In Files

- lib/openid/association.rb

### Parent

OpenID::AssociationManager

### Methods

- ::new
- #associate
- #get_all
- #get_association
- #invalidate
- #update

### Class/Module Index

Quicksearch

- OpenID
- OpenID::Association
- OpenID::AssociationManager
- OpenID::AuthenticationError
- OpenID::BaseAssociationManager
- OpenID::Consumer
- OpenID::ConsumerAssociation
- OpenID::DiffieHelmanAssociator
- OpenID::DumbAssociationManager
- OpenID::NoArgumentsError
- OpenID::NoOpenIDArgs
- OpenID::ProtocolError
- OpenID::Request
- OpenID::Response
- OpenID::ServerAssociation
- OpenID::SimpleHTTPClient
- OpenID::UserCancelled
- OpenID::UserSetupNeeded
- OpenID::ValueMismatchError
- String
- String::OpenID
- Bignum
- Crypto_math
- DateTime
- Fixnum

No matching classes.

# OpenID::BaseAssociationManager

### Public Class Methods

new(associator) click to toggle source

    # File lib/openid/association.rb, line 81
    def initialize(associator)
            @associator = associator
    end

### Public Instance Methods

associate(server_url) click to toggle source

Returns assoc_handle associated with server_url

    # File lib/openid/association.rb, line 85
    def associate(server_url)
            now = Time.now
            expired = []
            assoc = nil
            get_all(server_url).each { |current|
                    replace_after = current.get_replace_after
                    if current.expiry < now
                            expired.push(current)
                    elsif assoc == nil
                            assoc = current if replace_after > now
                    elsif replace_after > assoc.replace_after
                            assoc = current
                    end
            }
            new_assoc = nil
            if assoc == nil
                    assoc = new_assoc = @associator.associate(server_url)
            end
            if new_assoc or expired
                    update(new_assoc, expired)
            end

            return assoc.handle
    end

get_all(server_url) click to toggle source

This must be implemented by subclasses.

Should return a list of Association objects matching server_url

    # File lib/openid/association.rb, line 130
    def get_all(server_url)
            raise NotImplementedError
    end

get_association(server_url, assoc_handle) click to toggle source

    # File lib/openid/association.rb, line 110
    def get_association(server_url, assoc_handle)
            get_all(server_url).each { |assoc|
                    return assoc if assoc.handle == assoc_handle
            }
            return nil
    end

invalidate(server_url, assoc_handle) click to toggle source

This must be implemented by subclasses.

Subclass should remove the association for the given server_url and assoc_handle.

    # File lib/openid/association.rb, line 138
    def invalidate(server_url, assoc_handle)
            raise NotImplementedError
    end

update(new_assoc, expired) click to toggle source

This must be implemented by subclasses.

new_assoc is either a new association object or nil. Expired is a possibly empty list of expired associations. Subclass should add new_assoc if it is not nil, and expire each association in the expired list.

    # File lib/openid/association.rb, line 123
    def update(new_assoc, expired)
            raise NotImplementedError
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.