Class: Onlyoffice::DocsIntegrationSdk::DocumentServer::Client::Jwt

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/onlyoffice/docs_integration_sdk/document_server/client/jwt.rb

Overview

Jwt is a class that represents the JWT token configuration for the Document Server client.

Since:

  • 0.1.0

Defined Under Namespace

Classes: Location

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jwt:, locations: [Location::Header, Location::Body], header: "Authorization", schema: "Bearer") ⇒ void

initialize initializes a new Jwt instance. It makes a shallow copy of the locations list.

Parameters:

  • jwt (JwtEncoding) —

    The JWT token encoding configuration.

  • locations (Array<Location>) (defaults to: [Location::Header, Location::Body]) —

    The list of locations of the JWT token in the request.

  • header (String) (defaults to: "Authorization") —

    The header name of the JWT token in the request.

  • schema (String) (defaults to: "Bearer") —

    The schema of the JWT token in the request.

Since:

  • 0.1.0



101
102
103
104
105
106
107
108
109
110
111
# File 'lib/onlyoffice/docs_integration_sdk/document_server/client/jwt.rb', line 101

def initialize(
  jwt:,
  locations: [Location::Header, Location::Body],
  header: "Authorization",
  schema: "Bearer"
)
  @jwt = jwt
  @locations = T.let(locations.clone, T::Array[Location])
  @header = header
  @schema = schema
end

Instance Attribute Details

#header ⇒ String (readonly)

header is the header name of the JWT token in the request.

Examples:

req[jwt.header] = "#{jwt.schema} #{jwt.jwt.encode_header(payload)}"

Returns:

  • (String)

Since:

  • 0.1.0



71
72
73
# File 'lib/onlyoffice/docs_integration_sdk/document_server/client/jwt.rb', line 71

def header
  @header
end

#jwt ⇒ JwtEncoding (readonly)

jwt is the JWT token encoding configuration.

Returns:

Since:

  • 0.1.0



56
57
58
# File 'lib/onlyoffice/docs_integration_sdk/document_server/client/jwt.rb', line 56

def jwt
  @jwt
end

#locations ⇒ Array<Location> (readonly)

locations is the list of locations of the JWT token in the request.

Returns:

Since:

  • 0.1.0



62
63
64
# File 'lib/onlyoffice/docs_integration_sdk/document_server/client/jwt.rb', line 62

def locations
  @locations
end

#schema ⇒ String (readonly)

schema is the schema of the JWT token in the request.

Examples:

req[jwt.header] = "#{jwt.schema} #{jwt.jwt.encode_header(payload)}"

Returns:

  • (String)

Since:

  • 0.1.0



80
81
82
# File 'lib/onlyoffice/docs_integration_sdk/document_server/client/jwt.rb', line 80

def schema
  @schema
end