Skip to content

Commit

Permalink
bug: Remove API Key auth (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-marion authored Aug 8, 2024
1 parent abe740a commit c781a6f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 36 deletions.
12 changes: 6 additions & 6 deletions lib/chatbot-api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ export class ChatBotApi extends Construct {
path.join(__dirname, "schema/schema.graphql")
),
authorizationConfig: {
defaultAuthorization: {
authorizationType: appsync.AuthorizationType.USER_POOL,
userPoolConfig: {
userPool: props.userPool,
},
},
additionalAuthorizationModes: [
{
authorizationType: appsync.AuthorizationType.IAM,
},
{
authorizationType: appsync.AuthorizationType.USER_POOL,
userPoolConfig: {
userPool: props.userPool,
},
},
],
},
logConfig: {
Expand Down
2 changes: 1 addition & 1 deletion lib/chatbot-api/rest-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class ApiResolvers extends Construct {
);
}

if (props.config.rag.engines.knowledgeBase.enabled) {
if (props.config.rag.engines.knowledgeBase?.enabled) {
for (const item of props.config.rag.engines.knowledgeBase.external ||
[]) {
if (item.roleArn) {
Expand Down
2 changes: 1 addition & 1 deletion lib/model-interfaces/langchain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export class LangChainInterface extends Construct {
}
}

if (props.config.rag.engines.knowledgeBase.enabled) {
if (props.config.rag.engines.knowledgeBase?.enabled) {
for (const item of props.config.rag.engines.knowledgeBase.external ||
[]) {
if (item.roleArn) {
Expand Down
1 change: 0 additions & 1 deletion lib/user-interface/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export class UserInterface extends Construct {
aws_appsync_graphqlEndpoint: props.api.graphqlApi.graphqlUrl,
aws_appsync_region: cdk.Aws.REGION,
aws_appsync_authenticationType: "AMAZON_COGNITO_USER_POOLS",
aws_appsync_apiKey: props.api.graphqlApi?.apiKey,
Storage: {
AWSS3: {
bucket: props.chatbotFilesBucket.bucketName,
Expand Down
2 changes: 1 addition & 1 deletion lib/user-interface/react-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 10 additions & 26 deletions tests/chatbot-api/__snapshots__/chatbot-api-construct.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1352,19 +1352,8 @@ def submit_response(event: dict, context, response_status: str, error_message: s
{
"AuthenticationType": "AWS_IAM",
},
{
"AuthenticationType": "AMAZON_COGNITO_USER_POOLS",
"UserPoolConfig": {
"AwsRegion": {
"Ref": "AWS::Region",
},
"UserPoolId": {
"Ref": "AuthenticationUserPool28698864",
},
},
},
],
"AuthenticationType": "API_KEY",
"AuthenticationType": "AMAZON_COGNITO_USER_POOLS",
"LogConfig": {
"CloudWatchLogsRoleArn": {
"Fn::GetAtt": [
Expand All @@ -1375,25 +1364,20 @@ def submit_response(event: dict, context, response_status: str, error_message: s
"FieldLogLevel": "ALL",
},
"Name": "ChatbotGraphqlApi",
"UserPoolConfig": {
"AwsRegion": {
"Ref": "AWS::Region",
},
"DefaultAction": "ALLOW",
"UserPoolId": {
"Ref": "AuthenticationUserPool28698864",
},
},
"Visibility": "PRIVATE",
"XrayEnabled": true,
},
"Type": "AWS::AppSync::GraphQLApi",
},
"ChatBotApiConstructChatbotApiDefaultApiKeyB909A7CF": {
"DependsOn": [
"ChatBotApiConstructChatbotApiSchema07900657",
],
"Properties": {
"ApiId": {
"Fn::GetAtt": [
"ChatBotApiConstructChatbotApi21E23C68",
"ApiId",
],
},
},
"Type": "AWS::AppSync::ApiKey",
},
"ChatBotApiConstructChatbotApiLogRetentionCF5F6908": {
"Properties": {
"LogGroupName": {
Expand Down

0 comments on commit c781a6f

Please sign in to comment.