-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial implementation of standard AWS signer (#635)
- Loading branch information
Showing
38 changed files
with
1,256 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...-signing-common/common/src/aws/smithy/kotlin/runtime/auth/awssigning/HashSpecification.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
package aws.smithy.kotlin.runtime.auth.awssigning | ||
|
||
/** | ||
* Specifies a hash for a signable request | ||
*/ | ||
sealed class HashSpecification { | ||
/** | ||
* Indicates that the hash value should be calculated from the body payload of the request | ||
*/ | ||
object CalculateFromPayload : HashSpecification() | ||
|
||
/** | ||
* Specifies a literal value to use as a hash | ||
*/ | ||
sealed class HashLiteral(open val hash: String) : HashSpecification() | ||
|
||
/** | ||
* The hash value should indicate an unsigned payload | ||
*/ | ||
object UnsignedPayload : HashLiteral("UNSIGNED-PAYLOAD") | ||
|
||
/** | ||
* The hash value should indicate an empty body | ||
*/ | ||
object EmptyBody : HashLiteral("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") // hash of "" | ||
|
||
/** | ||
* The hash value should indicate that signature covers only headers and that there is no payload | ||
*/ | ||
object StreamingAws4HmacSha256Payload : HashLiteral("STREAMING-AWS4-HMAC-SHA256-PAYLOAD") | ||
|
||
/** | ||
* The hash value should indicate ??? | ||
*/ | ||
object StreamingAws4HmacSha256Events : HashLiteral("STREAMING-AWS4-HMAC-SHA256-EVENTS") | ||
|
||
/** | ||
* Use an explicit, precalculated value for the hash | ||
*/ | ||
data class Precalculated(override val hash: String) : HashLiteral(hash) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
description = "AWS Signer default implementation" | ||
extra["displayName"] = "Smithy :: Kotlin :: Standard AWS Signer" | ||
extra["moduleName"] = "aws.smithy.kotlin.runtime.auth.awssigning" | ||
|
||
val coroutinesVersion: String by project | ||
|
||
kotlin { | ||
sourceSets { | ||
commonMain { | ||
dependencies { | ||
api(project(":runtime:auth:aws-signing-common")) | ||
implementation(project(":runtime:hashing")) | ||
implementation(project(":runtime:logging")) | ||
} | ||
} | ||
|
||
commonTest { | ||
dependencies { | ||
implementation(project(":runtime:auth:aws-signing-tests")) | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion") | ||
} | ||
} | ||
|
||
all { | ||
languageSettings.optIn("aws.smithy.kotlin.runtime.util.InternalApi") | ||
} | ||
} | ||
} |
Oops, something went wrong.