-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adding support for cloudfront user principal
- Loading branch information
1 parent
7fc752d
commit e5d42d1
Showing
6 changed files
with
82 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
|
||
#Visual Studio Code settings | ||
/.vscode/ | ||
|
||
#Jetbrains settings | ||
.idea |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,23 @@ | ||
import {AbstractBasePrincipal} from './base'; | ||
|
||
class CloudFrontPrincipal extends AbstractBasePrincipal { | ||
private arn: string; | ||
|
||
constructor(arn: string) { | ||
super(); | ||
this.arn = arn; | ||
} | ||
|
||
static validate(input: string): string | undefined { | ||
const regex = new RegExp( | ||
'^arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity E(?=.*[A-Z])(?=.*[0-9])[A-Z0-9]{6,14}$'); | ||
const result = regex.exec(input) as RegExpExecArray; | ||
return result ? result[0] : undefined; | ||
} | ||
|
||
toJSON() { | ||
return {AWS: this.arn}; | ||
} | ||
} | ||
|
||
export {CloudFrontPrincipal}; |
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