Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

feat: update scopes and classifications #60

Merged
merged 3 commits into from
Oct 12, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ syntax = "proto3";
package google.cloud.recaptchaenterprise.v1beta1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.RecaptchaEnterprise.V1Beta1";
Expand All @@ -28,15 +31,18 @@ option java_package = "com.google.recaptchaenterprise.v1beta1";
option objc_class_prefix = "GCRE";
option php_namespace = "Google\\Cloud\\RecaptchaEnterprise\\V1beta1";


// Service to determine the likelihood an event is legitimate.
service RecaptchaEnterpriseServiceV1Beta1 {
option (google.api.default_host) = "recaptchaenterprise.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";

// Creates an Assessment of the likelihood an event is legitimate.
rpc CreateAssessment(CreateAssessmentRequest) returns (Assessment) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*}/assessments"
body: "assessment"
};
option (google.api.method_signature) = "parent,assessment";
}

// Annotates a previously created Assessment to provide additional information
Expand All @@ -46,17 +52,23 @@ service RecaptchaEnterpriseServiceV1Beta1 {
post: "/v1beta1/{name=projects/*/assessments/*}:annotate"
body: "*"
};
option (google.api.method_signature) = "name,annotation";
}
}

// The create assessment request message.
message CreateAssessmentRequest {
// Required. The name of the project in which the assessment will be created,
// in the format "projects/{project_number}".
string parent = 1;

// The asessment details.
Assessment assessment = 2;
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "cloudresourcemanager.googleapis.com/Project"
}
];

// Required. The assessment details.
Assessment assessment = 2 [(google.api.field_behavior) = REQUIRED];
}

// The request message to annotate an Assessment.
Expand All @@ -75,10 +87,15 @@ message AnnotateAssessmentRequest {

// Required. The resource name of the Assessment, in the format
// "projects/{project_number}/assessments/{assessment_id}".
string name = 1;

// The annotation that will be assigned to the Event.
Annotation annotation = 2;
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "recaptchaenterprise.googleapis.com/Assessment"
}
];

// Required. The annotation that will be assigned to the Event.
Annotation annotation = 2 [(google.api.field_behavior) = REQUIRED];
}

// Empty response for AnnotateAssessment.
Expand All @@ -88,57 +105,66 @@ message AnnotateAssessmentResponse {

// A recaptcha assessment resource.
message Assessment {
option (google.api.resource) = {
type: "recaptchaenterprise.googleapis.com/Assessment"
pattern: "projects/{project}/assessments/{assessment}"
};

// LINT.IfChange(classification_reason)
// Reasons contributing to the risk analysis verdict.
enum ClassificationReason {
// Default unspecified type.
CLASSIFICATION_REASON_UNSPECIFIED = 0;

// The event appeared to be automated.
// Interactions matched the behavior of an automated agent.
AUTOMATION = 1;

// The event was not made from the proper context on the real site.
// The event originated from an illegitimate environment.
UNEXPECTED_ENVIRONMENT = 2;

// Browsing behavior leading up to the event was generated was out of the
// ordinary.
// Traffic volume from the event source is higher than normal.
TOO_MUCH_TRAFFIC = 3;

// Interactions with the site were significantly different than expected
// patterns.
UNEXPECTED_USAGE_PATTERNS = 4;

// Too little traffic has been received from this site thus far to generate
// quality risk analysis.
PROVISIONAL_RISK_ANALYSIS = 5;
LOW_CONFIDENCE_SCORE = 5;
}

// Output only. The resource name for the Assessment in the format
// "projects/{project_number}/assessments/{assessment_id}".
string name = 1;
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

// The event being assessed.
Event event = 2;

// Output only. Legitimate event score from 0.0 to 1.0.
// (1.0 means very likely legitimate traffic while 0.0 means very likely
// non-legitimate traffic).
float score = 3;
float score = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Properties of the provided event token.
TokenProperties token_properties = 4;
TokenProperties token_properties = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Reasons contributing to the risk analysis verdict.
repeated ClassificationReason reasons = 5;
repeated ClassificationReason reasons = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}

message Event {
// The user response token provided by the reCAPTCHA client-side integration
// Required. The user response token provided by the reCAPTCHA client-side integration
// on your site.
string token = 1;
string token = 1 [(google.api.field_behavior) = REQUIRED];

// The site key that was used to invoke reCAPTCHA on your site and generate
// Required. The site key that was used to invoke reCAPTCHA on your site and generate
// the token.
string site_key = 2;
string site_key = 2 [(google.api.field_behavior) = REQUIRED];
}

message TokenProperties {
// LINT.IfChange
// Enum that represents the types of invalid token reasons.
enum InvalidReason {
// Default unspecified type.
Expand All @@ -156,7 +182,7 @@ message TokenProperties {
// The user verification had already been seen.
DUPE = 4;

// The user verification token did not match the provided site secret.
// The user verification token did not match the provided site key.
// This may be a configuration error (e.g. development keys used in
// production) or end users trying to use verification tokens from other
// sites.
Expand All @@ -166,18 +192,18 @@ message TokenProperties {
MISSING = 6;
}

// Output only. Whether the provided user response token is valid.
// Whether the provided user response token is valid.
bool valid = 1;

// Output only. Reason associated with the response when valid = false.
// Reason associated with the response when valid = false.
InvalidReason invalid_reason = 2;

// Output only. The timestamp corresponding to the generation of the token.
// The timestamp corresponding to the generation of the token.
google.protobuf.Timestamp create_time = 3;

// Output only. The hostname of the page on which the token was generated.
// The hostname of the page on which the token was generated.
string hostname = 4;

// Output only. Action name provided at token generation.
// Action name provided at token generation.
string action = 5;
}
Loading