Skip to content

Commit

Permalink
test fix, report initialised table name
Browse files Browse the repository at this point in the history
  • Loading branch information
fredex42 committed Mar 16, 2024
1 parent 5b53121 commit 11278fd
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
89 changes: 89 additions & 0 deletions cdk/lib/__snapshots__/concierge-graphql.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`The ConciergeGraphql stack matches the snapshot 1`] = `
"gu:cdk:constructs": [
"GuParameter",
"GuParameter",
"GuPolicy",
"GuPlayApp",
"GuCertificate",
"GuInstanceRole",
Expand Down Expand Up @@ -71,6 +72,94 @@ exports[`The ConciergeGraphql stack matches the snapshot 1`] = `
},
},
"Resources": {
"AuthTable0711E62F": {
"DeletionPolicy": "Retain",
"Properties": {
"AttributeDefinitions": [
{
"AttributeName": "ApiKey",
"AttributeType": "S",
},
{
"AttributeName": "Timestamp",
"AttributeType": "S",
},
],
"BillingMode": "PAY_PER_REQUEST",
"KeySchema": [
{
"AttributeName": "ApiKey",
"KeyType": "HASH",
},
{
"AttributeName": "Timestamp",
"KeyType": "RANGE",
},
],
"Tags": [
{
"Key": "gu:cdk:version",
"Value": "TEST",
},
{
"Key": "gu:repo",
"Value": "guardian/concierge-graphql",
},
{
"Key": "Stack",
"Value": "content-api",
},
{
"Key": "Stage",
"Value": "TEST",
},
],
},
"Type": "AWS::DynamoDB::Table",
"UpdateReplacePolicy": "Retain",
},
"AuthTableParam9777C3B3": {
"Properties": {
"Name": "/TEST/content-api/concierge-graphql/aws/auth_table",
"Tags": {
"Stack": "content-api",
"Stage": "TEST",
"gu:cdk:version": "TEST",
"gu:repo": "guardian/concierge-graphql",
},
"Type": "String",
"Value": {
"Ref": "AuthTable0711E62F",
},
},
"Type": "AWS::SSM::Parameter",
},
"AuthTablePolicy5F6B0D1E": {
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "dynamodb:GetItem",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"AuthTable0711E62F",
"Arn",
],
},
},
],
"Version": "2012-10-17",
},
"PolicyName": "AuthTablePolicy5F6B0D1E",
"Roles": [
{
"Ref": "InstanceRoleConciergegraphql96280BE9",
},
],
},
"Type": "AWS::IAM::Policy",
},
"AutoScalingGroupConciergegraphqlASG7A20D011": {
"Properties": {
"HealthCheckGracePeriod": 120,
Expand Down
2 changes: 2 additions & 0 deletions src/main/scala/security/ApiKeyAuth.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ object CacheTrackingEntry {

class ApiKeyAuth(dynamoDbClient:DynamoDbClient, tableName:String, cachingTtl:FiniteDuration) {
private val logger = LoggerFactory.getLogger(getClass)
logger.info(s"AWS dynamodb auth initialised. TableName is $tableName")

private var localCache:Map[String,UserTier] = Map()

private var cacheTracking:SortedSet[CacheTrackingEntry] = SortedSet()(CacheTrackingEntry.ordering)
Expand Down

0 comments on commit 11278fd

Please sign in to comment.