TsgcWSPClient_AMQP1Methods › PutCBSToken

PutCBSToken Method

Sends a Claims-Based Security (CBS) put-token request to the $cbs management link, authorising the given audience with the supplied token.

Syntax

function PutCBSToken(const aLink: TsgcAMQP1SenderLink; const aName, aTokenType, aToken: string; const aExpiration: Integer = 3600; aTimeout: Integer = 10000): Boolean;

Parameters

NameTypeDescription
aLinkconst TsgcAMQP1SenderLinkThe $cbs sender link previously returned by CreateCBSLink.
aNameconst stringAudience / resource URI the token authorises (for Azure Service Bus: sb://ns.servicebus.windows.net/entity).
aTokenTypeconst stringToken format advertised in the message type application-property — typically servicebus.windows.net:sastoken or servicebus.windows.net:jwt.
aTokenconst stringThe actual token string (SAS signature or JWT) carried in the message body.
aExpirationconst IntegerToken lifetime in seconds used to compute the expiration application-property and to schedule renewal. Default 3600.
aTimeoutIntegerHow long to wait (ms) for the $cbs management peer to reply with status-code 200 before returning false. Default 10000.

Return Value

True when $cbs returned status-code 200 (token accepted), False on timeout or any other reply status. (Boolean)

Remarks

CBS is the authorisation mechanism Azure Service Bus and Event Hubs layer on top of AMQP 1.0: instead of embedding credentials in the SASL handshake, the client attaches a pair of links to the reserved $cbs management node and pushes a "put-token" message containing a SAS signature or AAD JWT. The broker answers with a reply message whose status-code application-property is 200 on success. Call this method once per audience before attaching working links to the same entity — the token must be renewed before aExpiration elapses or future operations on that audience will be rejected.

Example


oCbs := oAMQP1.CreateCBSLink('cbs_1', 'session_1');
oAMQP1.PutCBSToken(oCbs,
  'sb://contoso.servicebus.windows.net/orders',
  'servicebus.windows.net:sastoken',
  sSasToken, 3600, 10000);

Back to Methods