Class: Authn::Tokens::ClusterAgentToken
- Inherits:
-
Object
- Object
- Authn::Tokens::ClusterAgentToken
- Defined in:
- lib/authn/tokens/cluster_agent_token.rb
Instance Attribute Summary collapse
-
#revocable ⇒ Object
readonly
Returns the value of attribute revocable.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(plaintext, source) ⇒ ClusterAgentToken
constructor
A new instance of ClusterAgentToken.
- #present_with ⇒ Object
- #revoke!(_current_user) ⇒ Object
Constructor Details
#initialize(plaintext, source) ⇒ ClusterAgentToken
Returns a new instance of ClusterAgentToken.
12 13 14 15 |
# File 'lib/authn/tokens/cluster_agent_token.rb', line 12 def initialize(plaintext, source) @revocable = ::Clusters::AgentToken.find_by_token(plaintext) @source = source end |
Instance Attribute Details
#revocable ⇒ Object (readonly)
Returns the value of attribute revocable.
10 11 12 |
# File 'lib/authn/tokens/cluster_agent_token.rb', line 10 def revocable @revocable end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
10 11 12 |
# File 'lib/authn/tokens/cluster_agent_token.rb', line 10 def source @source end |
Class Method Details
.prefix?(plaintext) ⇒ Boolean
6 7 8 |
# File 'lib/authn/tokens/cluster_agent_token.rb', line 6 def self.prefix?(plaintext) plaintext.start_with?(::Clusters::AgentToken::TOKEN_PREFIX) end |
Instance Method Details
#present_with ⇒ Object
17 18 19 |
# File 'lib/authn/tokens/cluster_agent_token.rb', line 17 def present_with ::API::Entities::Clusters::AgentToken end |
#revoke!(_current_user) ⇒ Object
21 22 23 24 25 |
# File 'lib/authn/tokens/cluster_agent_token.rb', line 21 def revoke!(_current_user) raise ::Authn::AgnosticTokenIdentifier::NotFoundError, 'Not Found' if revocable.blank? raise ::Authn::AgnosticTokenIdentifier::UnsupportedTokenError, 'Unsupported token type' end |