It emulates the behavior of Spring Data REST JPA
[email protected] |
[email protected] |
Verifying that "ariesmcrae.id" is my Blockstack ID. https://onename.com/ariesmcrae |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>React Counter</title> | |
</head> | |
<body> | |
<br/><br/> | |
<div id="app"></div> |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>React Counter</title> | |
</head> | |
<body> | |
<br/><br/> | |
<div id="app"></div> |
private static Map<String, String> parameterStore() { | |
final AWSSimpleSystemsManagement client = AWSSimpleSystemsManagementClientBuilder.defaultClient(); | |
GetParametersRequest request = new GetParametersRequest(); | |
request.withNames("driver", "host", "port", "schema", "username", "password").setWithDecryption(true); | |
GetParametersResult result = client.getParameters(request); | |
Map<String, String> store = new HashMap<>(); |
private static Map<String, String> getStore() { | |
final String dynamoDbTableName = "credential-store"; | |
AmazonDynamoDB dynamoDbClient = AmazonDynamoDBClientBuilder | |
.standard() | |
.withRegion(Regions.AP_SOUTHEAST_2) | |
.build(); | |
AWSKMS awskmsClient = AWSKMSClientBuilder | |
.standard() |
public static String maskCreditCard(String sentenceThatMightContainACreditCard) { | |
String maskedSentence = null; | |
// Find sequence of numbers between 13-16. | |
// Numbers can have dashes, spaces, or no dashes / no spaces. | |
Pattern regex = Pattern.compile("\\b(?:\\d[ -]*?){13,16}\\b"); | |
Matcher regexMatcher = regex.matcher(sentenceThatMightContainACreditCard); | |
if (regexMatcher.find()) { |
//http://docs.aws.amazon.com/lambda/latest/dg/env_variables.html | |
public static Sql2o getSql2oInstance() { | |
//These will get environment values from the AWS Lambda, | |
//which are declared in the Lambda web page. | |
final String host = System.getenv("host"); | |
final String port = System.getenv("port"); | |
final String schema = System.getenv("schema"); | |
final String username = System.getenv("username"); | |
final String password = System.getenv("password"); | |
It emulates the behavior of Spring Data REST JPA
[email protected] |
[email protected] |
/** | |
* This will mask a portion of a credit card with 'x' if it finds it in a sentence. | |
\b(?: | |
# Visa card number 4[\ -]*(?:\d[\ -]*){11}(?:(?:\d[\ -]*){3})?\d| | |
# MasterCard card number (?:5[\ -]*[1-5](?:[\ -]*\d){2}|(?:2[\ | |
-]*){3}[1-9]|(?:2[\ -]*){2}[3-9][\ -]*\d|2[\ -]* [3-6](?:[\ -]*\d){2}|2[\ | |
-]*7[\ -]*[01][\ -]*\d|2[\ -]*7[\ -]*2[\ -]*0)(?:[\ -]*\d){12}| | |
/** | |
* Performs date validation and conversion of String to LocalDate.<br/> | |
* If valid, then date string is converted to LocalDate. | |
* @param input Date string in format. | |
* @return the LocalDate. | |
*/ | |
public static LocalDate toDate(String date) { | |
if (date == null || date.trim().length() == 0) { | |
throw new RuntimeException("Date input can't be null."); | |
} |