class

OAuth2::Provider::AccessToken

Inherits Ktistec::Model::Common < Ktistec::Model < Reference < Object

Constants

RENEWAL_THRESHOLD = (TTL * 7) / 8

Renew once more than 1/8th of the TTL has elapsed since the last renewal.

TTL = 30.days

The lifetime granted to a token at issue or renewal.

Class methods

find_by_token?(token : String)

Finds an access token given its token string.

Source
invalidate_for(account : Account)

Removes every access token associated with an account.

Source

Instance methods

_association_account
Source
_association_client
Source
_association_session

The session.

Links to the Session if one exists for this access token.

Source
_belongs_to_setter_for_account(account_ : Account, update_associations = true) : Account
Source
_belongs_to_setter_for_client(client_ : Client, update_associations = true) : Client
Source
_has_one_setter_for_session(session_ : Session, update_associations = true) : Session

The session.

Links to the Session if one exists for this access token.

Source
account(include_deleted : Bool = false, include_undone : Bool = false) : Account
Source
account=(account_ : Account) : Account
Source
account?(include_deleted : Bool = false, include_undone : Bool = false) : Account | Nil
Source
account_id

The account ID.

Links the access token to the Account model. It identifies which user the token represents.

Source
account_id=(account_id : Int64 | Nil)

The account ID.

Links the access token to the Account model. It identifies which user the token represents.

Source
client(include_deleted : Bool = false, include_undone : Bool = false) : Client
Source
client=(client_ : Client) : Client
Source
client?(include_deleted : Bool = false, include_undone : Bool = false) : Client | Nil
Source
client_id

The client application ID.

Links the access token to the OAuth2 Client model. It identifies which application this token was issued to.

Source
client_id=(client_id : Int64 | Nil)

The client application ID.

Links the access token to the OAuth2 Client model. It identifies which application this token was issued to.

Source
expired?

Checks if the access token is expired.

Source
expires_at

The expiration.

A timestamp that indicates when the access token becomes invalid.

Source
expires_at=(expires_at : Time)

The expiration.

A timestamp that indicates when the access token becomes invalid.

Source
has_mcp_scope?

Checks if the access token has "mcp" scope.

Source
scope

Scopes.

Stores the specific permissions that the user granted when they authorized the application.

Source
scope=(scope : String)

Scopes.

Stores the specific permissions that the user granted when they authorized the application.

Source
session(include_deleted : Bool = false, include_undone : Bool = false) : Session

The session.

Links to the Session if one exists for this access token.

Source
session=(session_ : Session) : Session

The session.

Links to the Session if one exists for this access token.

Source
session?(include_deleted : Bool = false, include_undone : Bool = false) : Session | Nil

The session.

Links to the Session if one exists for this access token.

Source
token

The access token string.

This is a unique, randomly generated, and unguessable value that the client application uses to authenticate its requests to the server. The client sends this token in the Authorization header of an API request.

Source
token=(token : String)

The access token string.

This is a unique, randomly generated, and unguessable value that the client application uses to authenticate its requests to the server. The client sends this token in the Authorization header of an API request.

Source
touch

Slides the expiration forward when the token is used.

No-op for expired tokens and for tokens still within the renewal threshold.

Source