Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// },
Origins: [
{
Id: "s3Origin",
DomainName: Fn.GetAtt("ClientBucket", "DomainName"),
S3OriginConfig: {
OriginAccessIdentity: Fn.Join("/", [
"origin-access-identity/cloudfront",
Fn.Ref("ClientOriginAccessIdentity")
])
}
}
],
PriceClass: "PriceClass_100", // PriceClass_100 | PriceClass_200 | PriceClass_All
ViewerCertificate: {
AcmCertificateArn: Fn.ImportValue(
`${pascalCaseDomainName(config.ROOT_DOMAIN)}Certificate`
),
MinimumProtocolVersion: "TLSv1.1_2016",
SslSupportMethod: "sni-only"
}
}
}).dependsOn(["ClientBucket", "ClientOriginAccessIdentity"]);
import { ApiGateway, Fn } from "cloudform";
export const DomainName = new ApiGateway.DomainName({
DomainName: Fn.Join(".", [Fn.Ref("SubDomain"), Fn.ImportValue("RootDomain")]),
CertificateArn: Fn.ImportValue("Certificate")
}).dependsOn("ApiGateway");
import { Cognito, Fn } from "cloudform";
export const IdentityPoolRoleAttachment = new Cognito.IdentityPoolRoleAttachment({
IdentityPoolId: Fn.ImportValue("IdentityPoolId"),
Roles: {
authenticated: Fn.GetAtt("CustomerRole", "Arn"),
unauthenticated: Fn.GetAtt("UnauthenticatedUserRole", "Arn")
}
});
import { ApiGateway, Fn } from "cloudform";
export const DomainName = new ApiGateway.DomainName({
DomainName: Fn.Join(".", [Fn.Ref("SubDomain"), Fn.ImportValue("RootDomain")]),
CertificateArn: Fn.ImportValue("Certificate")
}).dependsOn("ApiGateway");
import { IAM, Fn } from "cloudform";
export const UnauthenticatedUserRole = new IAM.Role({
RoleName: "passninja-unauthenticated-user-role",
AssumeRolePolicyDocument: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: {
Federated: "cognito-identity.amazonaws.com"
},
Action: "sts:AssumeRoleWithWebIdentity",
Condition: {
StringEquals: {
"cognito-identity.amazonaws.com:aud": Fn.ImportValue("IdentityPoolId")
},
"ForAnyValue:StringLike": {
"cognito-identity.amazonaws.com:amr": "unauthenticated"
}
}
}
]
}
});
import { Route53, Fn } from "cloudform";
import { config } from "../../config";
import { pascalCaseDomainName } from "../../lib";
export const ClientRecordSet = new Route53.RecordSet({
Name: Fn.Join(".", [Fn.Ref("SubDomain"), config.ROOT_DOMAIN]),
Type: "A",
HostedZoneId: Fn.ImportValue(`${pascalCaseDomainName(config.ROOT_DOMAIN)}HostedZone`),
AliasTarget: {
DNSName: Fn.GetAtt("ClientDistribution", "DomainName"),
HostedZoneId: "Z2FDTNDATAQYW2"
}
}).dependsOn("ClientDistribution");
import { Route53, Fn } from "cloudform";
import { config } from "../../config";
import { pascalCaseDomainName } from "../../lib";
export const ServerRecordSet = new Route53.RecordSet({
Name: Fn.Join(".", [Fn.Ref("SubDomain"), config.ROOT_DOMAIN]),
Type: "A",
HostedZoneId: Fn.ImportValue(`${pascalCaseDomainName(config.ROOT_DOMAIN)}HostedZone`),
AliasTarget: {
DNSName: Fn.GetAtt("DomainName", "DistributionDomainName"),
HostedZoneId: Fn.GetAtt("DomainName", "DistributionHostedZoneId")
}
}).dependsOn("DomainName");
import { IAM, Fn } from "cloudform";
export const CustomerRole = new IAM.Role({
RoleName: "passninja-customer-role",
AssumeRolePolicyDocument: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: {
Federated: "cognito-identity.amazonaws.com"
},
Action: "sts:AssumeRoleWithWebIdentity",
Condition: {
StringEquals: {
"cognito-identity.amazonaws.com:aud": Fn.ImportValue("IdentityPoolId")
},
"ForAnyValue:StringLike": {
"cognito-identity.amazonaws.com:amr": "authenticated"
}
}
}
]
}
});