aws-sdk-signers
AWS SDK Signers provides stand-alone signing functionality for use with HTTP tools such as AioHTTP, Curl, Postman, Requests, urllib3, etc.
AsyncBytesReader
¶
A file-like object with an async read method.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_io.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
closed
property
¶
Returns whether the stream is closed.
__init__(data)
¶
Initializes self.
Data is read from the source on an as-needed basis and is not buffered.
:param data: The source data to read from.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_io.py
close()
¶
Closes the stream, as well as the underlying stream where possible.
iter_chunks(chunk_size=_DEFAULT_CHUNK_SIZE)
¶
Iterate over the reader in chunks of a given size.
:param chunk_size: The maximum size of each chunk. If less than 0, the entire reader will be read into one chunk.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_io.py
read(size=-1)
async
¶
Read a number of bytes from the stream.
:param size: The maximum number of bytes to read. If less than 0, all bytes will be read.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_io.py
readable()
¶
seekable()
¶
AsyncSigV4Signer
¶
Request signer for applying the AWS Signature Version 4 algorithm.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 |
|
canonical_request(*, signing_properties, request)
async
¶
The canonical request is a standardized string laying out the components used in the SigV4 signing algorithm. This is useful to quickly compare inputs to find signature mismatches and unintended variances.
The SigV4 specification defines the canonical request to be
:param signing_properties: SigV4SigningProperties to define signing primitives such as the target service, region, and date. :param request: An AWSRequest to use for generating a SigV4 signature.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
generate_authorization_field(*, credential, signed_headers, signature)
async
¶
Generate the Authorization
field.
:param credential:
Credential scope string for generating the Authorization header.
Defined as:
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
sign(*, request, identity, properties)
async
¶
Generate and apply a SigV4 Signature to a copy of the supplied request.
:param request: An AWSRequest to sign prior to sending to the service. :param identity: A set of credentials representing an AWS Identity or role capacity. :param properties: SigV4SigningProperties to define signing primitives such as the target service, region, and date.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
string_to_sign(*, canonical_request, signing_properties)
async
¶
The string to sign is the second step of our signing algorithm which concatenates the formal identifier of our signing algorithm, the signing DateTime, the scope of our credentials, and a hash of our previously generated canonical request. This is another checkpoint that can be used to ensure we're constructing our signature as intended.
The SigV4 specification defines the string to sign as
Algorithm
RequestDateTime
CredentialScope
HashedCanonicalRequest
:param canonical_request:
String generated from the canonical_request
method.
:param signing_properties:
SigV4SigningProperties to define signing primitives such as
the target service, region, and date.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
Field
¶
Bases: Field
A name-value pair representing a single field in an HTTP Request or Response.
The kind will dictate metadata placement within an HTTP message.
All field names are case insensitive and case-variance must be treated as equivalent. Names may be normalized but should be preserved for accuracy during transmission.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
__eq__(other)
¶
Name, values, and kind must match.
Values order must match.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
add(value)
¶
as_string(delimiter=',')
¶
Get delimited string of all values. A comma followed by a space is used by default.
If the Field
has zero values, the empty string is returned. If the Field
has exactly one value, the value is returned unmodified.
For Field
s with more than one value, the values are joined by a comma and a
space. For such multi-valued Field
s, any values that already contain
commas or double quotes will be surrounded by double quotes. Within any values
that get quoted, pre-existing double quotes and backslashes are escaped with a
backslash.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
as_tuples()
¶
Get list of name
, value
tuples where each tuple represents one
value.
remove(value)
¶
Fields
¶
Bases: Fields
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
__delitem__(name)
¶
__eq__(other)
¶
Encoding must match.
Entries must match in values and order.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
__getitem__(name)
¶
__init__(initial=None, *, encoding='utf-8')
¶
Collection of header and trailer entries mapped by name.
:param initial: Initial list of Field
objects. Field
s can also be added
and later removed.
:param encoding: The string encoding to be used when converting the Field
name and value from str
to bytes
for transmission.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
__setitem__(name, field)
¶
Set or override entry for a Field name.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
extend(other)
¶
Merges entries
of other
into the current entries
.
For every Field
in the entries
of other
: If the normalized name
already exists in the current entries
, the values from other
are
appended. Otherwise, the Field
is added to the list of entries
.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
get_by_type(kind)
¶
Helper function for retrieving specific types of fields.
Used to grab all headers or all trailers.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
set_field(field)
¶
Alias for setitem to utilize the field.name for the entry key.
SigV4Signer
¶
Request signer for applying the AWS Signature Version 4 algorithm.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
|
canonical_request(*, signing_properties, request)
¶
The canonical request is a standardized string laying out the components used in the SigV4 signing algorithm. This is useful to quickly compare inputs to find signature mismatches and unintended variances.
The SigV4 specification defines the canonical request to be
:param signing_properties: SigV4SigningProperties to define signing primitives such as the target service, region, and date. :param request: An AWSRequest to use for generating a SigV4 signature.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
generate_authorization_field(*, credential, signed_headers, signature)
¶
Generate the Authorization
field.
:param credential:
Credential scope string for generating the Authorization header.
Defined as:
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
sign(*, request, identity, properties)
¶
Generate and apply a SigV4 Signature to a copy of the supplied request.
:param request: An AWSRequest to sign prior to sending to the service. :param identity: A set of credentials representing an AWS Identity or role capacity. :param properties: SigV4SigningProperties to define signing primitives such as the target service, region, and date.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
string_to_sign(*, canonical_request, signing_properties)
¶
The string to sign is the second step of our signing algorithm which concatenates the formal identifier of our signing algorithm, the signing DateTime, the scope of our credentials, and a hash of our previously generated canonical request. This is another checkpoint that can be used to ensure we're constructing our signature as intended.
The SigV4 specification defines the string to sign as
Algorithm
RequestDateTime
CredentialScope
HashedCanonicalRequest
:param canonical_request:
String generated from the canonical_request
method.
:param signing_properties:
SigV4SigningProperties to define signing primitives such as
the target service, region, and date.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
URI
dataclass
¶
Bases: URI
Universal Resource Identifier, target location for a :py:class:HTTPRequest
.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
|
fragment = None
class-attribute
instance-attribute
¶
Part of the URI specification, but may not be transmitted by a client.
host
instance-attribute
¶
The hostname, for example amazonaws.com
.
netloc
property
¶
Construct netloc string in format {username}:{password}@{host}:{port}
username
, password
, and port
are only included if set. password
is ignored, unless username
is also set.
password = None
class-attribute
instance-attribute
¶
Password part of the userinfo URI component.
path = None
class-attribute
instance-attribute
¶
Path component of the URI.
port = None
class-attribute
instance-attribute
¶
An explicit port number.
query = None
class-attribute
instance-attribute
¶
Query component of the URI as string.
scheme = 'https'
class-attribute
instance-attribute
¶
For example http
or https
.
username = None
class-attribute
instance-attribute
¶
Username part of the userinfo URI component.
build()
¶
Construct URI string representation.
Validate host. Returns a string of the form
{scheme}://{username}:{password}@{host}:{port}{path}?{query}#{fragment}
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/_http.py
exceptions
¶
BaseAWSSDKException
¶
MissingExpectedParameterException
¶
Bases: BaseAWSSDKException
, ValueError
Some APIs require specific signing properties to be present.
interfaces
¶
events
¶
HEADERS_DICT = Mapping[str, HEADER_VALUE]
¶
A dictionary of event headers.
HEADER_VALUE = bool | int | bytes | str | datetime.datetime | uuid.UUID
¶
A union of valid value types for event headers.
EventHeaderEncoder
¶
Bases: Protocol
A utility class that encodes event headers into bytes.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/events.py
EventMessage
¶
Bases: Protocol
A signable message that may be sent over an event stream.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/events.py
http
¶
Field
¶
Bases: Protocol
A name-value pair representing a single field in a request or response.
The kind will dictate metadata placement within a message, for example as a header or trailer field in an HTTP request as defined in RFC 9110 Section 5.
All field names are case insensitive and case-variance must be treated as equivalent. Names may be normalized but should be preserved for accuracy during transmission.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/http.py
FieldPosition
¶
Bases: Enum
The type of a field.
Defines its placement in a request or response.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/http.py
HEADER = 0
class-attribute
instance-attribute
¶
Header field.
In HTTP this is a header as defined in RFC 9110 Section 6.3. Implementations of other protocols may use this FieldPosition for similar types of metadata.
TRAILER = 1
class-attribute
instance-attribute
¶
Trailer field.
In HTTP this is a trailer as defined in RFC 9110 Section 6.5. Implementations of other protocols may use this FieldPosition for similar types of metadata.
Fields
¶
Bases: Protocol
Protocol agnostic mapping of key-value pair request metadata, such as HTTP fields.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/http.py
__delitem__(name)
¶
__getitem__(name)
¶
__iter__()
¶
__len__()
¶
__setitem__(name, field)
¶
extend(other)
¶
Merges entries
of other
into the current entries
.
For every Field
in the entries
of other
: If the normalized name
already exists in the current entries
, the values from other
are
appended. Otherwise, the Field
is added to the list of entries
.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/http.py
get_by_type(kind)
¶
Helper function for retrieving specific types of fields.
Used to grab all headers or all trailers.
Request
¶
Bases: Protocol
Protocol-agnostic representation of a request.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/http.py
URI
¶
Bases: Protocol
Universal Resource Identifier, target location for a :py:class:Request
.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/http.py
fragment
instance-attribute
¶
Part of the URI specification, but may not be transmitted by a client.
host
instance-attribute
¶
The hostname, for example amazonaws.com
.
netloc
property
¶
Construct netloc string in format {username}:{password}@{host}:{port}
password
instance-attribute
¶
Password part of the userinfo URI component.
path
instance-attribute
¶
Path component of the URI.
port
instance-attribute
¶
An explicit port number.
query
instance-attribute
¶
Query component of the URI as string.
scheme
instance-attribute
¶
For example http
or mqtts
.
username
instance-attribute
¶
Username part of the userinfo URI component.
build()
¶
Construct URI string representation.
Returns a string of the form
{scheme}://{username}:{password}@{host}:{port}{path}?{query}#{fragment}
identity
¶
AWSCredentialsIdentity
¶
Bases: Identity
, Protocol
AWS Credentials Identity.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/identity.py
access_key_id
instance-attribute
¶
A unique identifier for an AWS user or role.
secret_access_key
instance-attribute
¶
A secret key used in conjunction with the access key ID to authenticate programmatic access to AWS services.
session_token = None
class-attribute
instance-attribute
¶
A temporary token used to specify the current session for the supplied credentials.
Identity
¶
Bases: Protocol
An entity available to the client representing who the user is.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/identity.py
io
¶
AsyncByteStream
¶
Bases: Protocol
A file-like object with an async read method.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/io.py
AsyncSeekable
¶
Bases: Protocol
An async file-like object with seek and tell implemented.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/io.py
ByteStream
¶
Bases: Protocol
A file-like object with a read method that returns bytes.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/io.py
ConditionallySeekable
¶
Bases: Protocol
A file-like object that is conditionally seekable.
This is separate from Seekable and AsyncSeekable as seekable objects may not define this method.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/io.py
Seekable
¶
Bases: Protocol
A file-like object with seek and tell implemented.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/interfaces/io.py
signers
¶
AsyncSigV4Signer
¶
Request signer for applying the AWS Signature Version 4 algorithm.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 |
|
canonical_request(*, signing_properties, request)
async
¶
The canonical request is a standardized string laying out the components used in the SigV4 signing algorithm. This is useful to quickly compare inputs to find signature mismatches and unintended variances.
The SigV4 specification defines the canonical request to be
:param signing_properties: SigV4SigningProperties to define signing primitives such as the target service, region, and date. :param request: An AWSRequest to use for generating a SigV4 signature.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
generate_authorization_field(*, credential, signed_headers, signature)
async
¶
Generate the Authorization
field.
:param credential:
Credential scope string for generating the Authorization header.
Defined as:
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
sign(*, request, identity, properties)
async
¶
Generate and apply a SigV4 Signature to a copy of the supplied request.
:param request: An AWSRequest to sign prior to sending to the service. :param identity: A set of credentials representing an AWS Identity or role capacity. :param properties: SigV4SigningProperties to define signing primitives such as the target service, region, and date.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
string_to_sign(*, canonical_request, signing_properties)
async
¶
The string to sign is the second step of our signing algorithm which concatenates the formal identifier of our signing algorithm, the signing DateTime, the scope of our credentials, and a hash of our previously generated canonical request. This is another checkpoint that can be used to ensure we're constructing our signature as intended.
The SigV4 specification defines the string to sign as
Algorithm
RequestDateTime
CredentialScope
HashedCanonicalRequest
:param canonical_request:
String generated from the canonical_request
method.
:param signing_properties:
SigV4SigningProperties to define signing primitives such as
the target service, region, and date.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
SigV4Signer
¶
Request signer for applying the AWS Signature Version 4 algorithm.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
|
canonical_request(*, signing_properties, request)
¶
The canonical request is a standardized string laying out the components used in the SigV4 signing algorithm. This is useful to quickly compare inputs to find signature mismatches and unintended variances.
The SigV4 specification defines the canonical request to be
:param signing_properties: SigV4SigningProperties to define signing primitives such as the target service, region, and date. :param request: An AWSRequest to use for generating a SigV4 signature.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
generate_authorization_field(*, credential, signed_headers, signature)
¶
Generate the Authorization
field.
:param credential:
Credential scope string for generating the Authorization header.
Defined as:
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
sign(*, request, identity, properties)
¶
Generate and apply a SigV4 Signature to a copy of the supplied request.
:param request: An AWSRequest to sign prior to sending to the service. :param identity: A set of credentials representing an AWS Identity or role capacity. :param properties: SigV4SigningProperties to define signing primitives such as the target service, region, and date.
Source code in packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
string_to_sign(*, canonical_request, signing_properties)
¶
The string to sign is the second step of our signing algorithm which concatenates the formal identifier of our signing algorithm, the signing DateTime, the scope of our credentials, and a hash of our previously generated canonical request. This is another checkpoint that can be used to ensure we're constructing our signature as intended.
The SigV4 specification defines the string to sign as
Algorithm
RequestDateTime
CredentialScope
HashedCanonicalRequest
:param canonical_request:
String generated from the canonical_request
method.
:param signing_properties:
SigV4SigningProperties to define signing primitives such as
the target service, region, and date.