Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: AWS Lambda authorizer support #478

Merged
merged 12 commits into from
Jul 29, 2021
Merged

feat: AWS Lambda authorizer support #478

merged 12 commits into from
Jul 29, 2021

Conversation

diegocstn
Copy link
Contributor

@diegocstn diegocstn commented Jul 22, 2021

Description of changes:
This PR introduces the changes to support for AWS Lambda authorizer.
Customers will be able to use the new AWS_LAMBDA authorization type by providing an instance of a type conforming to the AWSLambdaAuthProvider protocol, similarly to as they currently do for OIDC.

Example of dx:

struct MyAuthProvider: AWSLambdaAuthProvider {
    func getLatestAuthToken() -> String {
        "custom-lambda-token"
    }
}
``

let authProvider = MyAuthProvider()
let serviceConfig = try AWSAppSyncServiceConfig()
let config = try AWSAppSyncClientConfiguration(
    appSyncServiceConfig: serviceConfig,
    awsLambdaAuthProvider: authProvider)

let appSyncClient = try AWSAppSyncClient(appSyncConfig: config)

References
Amplify iOS PR: aws-amplify/amplify-swift#1334
Amplify Android PR: aws-amplify/amplify-android#1412
AppSync SDK Android PR: awslabs/aws-mobile-appsync-sdk-android#358

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@diegocstn diegocstn marked this pull request as ready for review July 27, 2021 19:37
Copy link
Contributor

@royjit royjit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only concern I had is regarding inheriting the protocol AWSLambdaAuthProvider from AWSOIDCAuthProvider. Please provide comments on why it was done so

@diegocstn
Copy link
Contributor Author

@royjit The idea was to re-use the OIDC interceptor given that they both just add a token as the authorization header value. Changed to use a custom interceptor as I did for Amplify and removed the protocol conformance.
I'm gonna create a story to refactor the auth interceptors across packages. I believe we can re-use some code there.

@diegocstn diegocstn merged commit 8428fff into main Jul 29, 2021
@diegocstn diegocstn deleted the feat/lambda-auth branch July 29, 2021 20:45
karim-alweheshy added a commit to chocoapp/aws-mobile-appsync-sdk-ios that referenced this pull request Oct 13, 2021
* orignal-main:
  New deploy API key (awslabs#496)
  Release SDK version 3.4.1
  Update CHANGELOG.md (awslabs#494)
  Update to SDK 2.26.0 (awslabs#492)
  fix: Update tests to avoid 'await' keyword (awslabs#490)
  chore: update CHANGELOG.md (awslabs#489)
  Release SDK version 3.4.0
  fix: lambda async auth provider (awslabs#488)
  New deploy API key
  New deploy API key (awslabs#485)
  Release SDK version 3.3.1
  chore: update AWS SDKs to v2.25.0 (awslabs#484)
  New deploy API key (awslabs#482)
  Release SDK version 3.3.0
  chore: Update CHANGELOG.md (awslabs#481)
  feat: AWS Lambda authorizer support (awslabs#478)
  New deploy API key (awslabs#477)

# Conflicts:
#	AWSAppSyncClient/AWSAppSyncHTTPNetworkTransport.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants