Skip to content

Commit ca13436

Browse files
committed
docs(samples): adding README.md (#557)
1 parent 6c4ac95 commit ca13436

File tree

1 file changed

+77
-0
lines changed
  • recaptcha_enterprise/cloud-client/src

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Google Cloud reCAPTCHA Enterprise
2+
3+
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-recaptchaenterprise&page=editor&open_in_editor=samples/snippets/cloud-client/src/README.md">
4+
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>
5+
6+
Google [Cloud reCAPTCHA Enterprise](https://cloud.google.com/recaptcha-enterprise) defends your website against common
7+
web-based attacks like credential stuffing, account takeovers, and scraping and
8+
help prevent costly exploits from malicious human and automated actors.
9+
Just like reCAPTCHA v3, reCAPTCHA Enterprise will never interrupt your
10+
users with a challenge, so you can run it on all webpages where your customers interact with your services.
11+
12+
These sample Java applications demonstrate how to access the Cloud reCAPTCHA Enterprise API using the
13+
Google Java API Client Libraries.
14+
15+
## Prerequisites
16+
17+
### Google Cloud Project
18+
19+
Set up a Google Cloud project with billing enabled.
20+
21+
### Enable the API
22+
23+
You must [enable the Google reCAPTCHA Enterprise API](https://console.cloud.google.com/flows/enableapi?apiid=recaptchaenterprise.googleapis.com) for your project in order to use these samples.
24+
25+
### Service account
26+
27+
A service account with private key credentials is required to create signed bearer tokens.
28+
Create a [service account](https://console.cloud.google.com/iam-admin/serviceaccounts/create) and download the credentials file as JSON.
29+
30+
### Set Environment Variables
31+
32+
You must set your project ID and service account credentials in order to run the tests.
33+
34+
```
35+
$ export GOOGLE_CLOUD_PROJECT="<google-project-id-here>"
36+
$ export GOOGLE_APPLICATION_CREDENTIALS="<path-to-service-account-credentials-file>"
37+
```
38+
39+
### Grant Permissions
40+
41+
You must ensure that the [user account or service account](https://cloud.google.com/iam/docs/service-accounts#differences_between_a_service_account_and_a_user_account) you used to authorize your gcloud session has the proper permissions to edit reCAPTCHA resources for your project. In the Cloud Console under IAM, add the following roles (as needed) to the project whose service account you're using to test:
42+
43+
* reCAPTCHA Enterprise Agent
44+
* reCAPTCHA Enterprise Admin
45+
* reCAPTCHA Enterprise Viewer
46+
47+
More information can be found in the [Google reCAPTCHA Enterprise Docs](https://cloud.google.com/recaptcha-enterprise/docs/access-control).
48+
49+
50+
## Build and Run
51+
52+
The following instructions will help you prepare your development environment.
53+
54+
1. Download and install the [Java Development Kit (JDK)](https://www.oracle.com/java/technologies/javase-downloads.html).
55+
Verify that the [JAVA_HOME](https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/envvars001.html) environment variable is set and points to your JDK installation.
56+
57+
58+
2. Download and install [Apache Maven](http://maven.apache.org/download.cgi) by following the [Maven installation guide](http://maven.apache.org/install.html) for your specific operating system.
59+
60+
61+
3. Clone the java-recaptchaenterprise repository.
62+
```
63+
git clone https://github.com/googleapis/java-recaptchaenterprise.git
64+
```
65+
66+
4. Navigate to the sample code directory.
67+
68+
```
69+
cd java-recaptchaenterprise/samples/snippets/cloud-client/src
70+
```
71+
72+
5. Run the **SnippetsIT** test file present under the test folder.
73+
74+
### Test Frameworks used
75+
[Spring Boot module](https://spring.io/projects/spring-boot) from Spring Framework.
76+
77+
[Selenium](https://www.selenium.dev/).

0 commit comments

Comments
 (0)