Class: PadlockAuth::AbstractStrategy Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/padlock_auth/abstract_strategy.rb

Overview

This class is abstract.

Abstract strategy for building and authenticating access tokens.

Strategies are responsible for building access tokens and authenticating them.

Direct Known Subclasses

Token::Strategy

Instance Method Summary collapse

Instance Method Details

#build_access_token(_raw_token) ⇒ PadlockAuth::AbstractAccessToken?

Build an access token from a raw token.



13
14
15
16
# File 'lib/padlock_auth/abstract_strategy.rb', line 13

def build_access_token(_raw_token)
  Kernel.warn "[PADLOCK_AUTH] #build_access_token not implemented for #{self.class}"
  nil
end

#build_access_token_from_credentials(_username, _password) ⇒ PadlockAuth::AbstractAccessToken?

Build an access token from credentials.



24
25
26
27
# File 'lib/padlock_auth/abstract_strategy.rb', line 24

def build_access_token_from_credentials(_username, _password)
  Kernel.warn "[PADLOCK_AUTH] #build_access_token_from_credentials not implemented for #{self.class}"
  nil
end

#build_forbidden_token_response(access_token, scopes) ⇒ PadlockAuth::Http::ForbiddenTokenResponse

Build a forbidden token response.

Used to indicate that a token does not have the required scopes.



48
49
50
# File 'lib/padlock_auth/abstract_strategy.rb', line 48

def build_forbidden_token_response(access_token, scopes)
  Http::ForbiddenTokenResponse.from_access_token(access_token, scopes)
end

#build_invalid_token_response(access_token) ⇒ PadlockAuth::Http::InvalidTokenResponse

Build an invalid token response.

Used to indicate that a token is invalid.



36
37
38
# File 'lib/padlock_auth/abstract_strategy.rb', line 36

def build_invalid_token_response(access_token)
  Http::InvalidTokenResponse.from_access_token(access_token)
end