Add IdP swagger details and HTTP endpoints to RPCs

Signed-off-by: Akshay Gaikwad <akshay.gaikwad@rafay.co>
This commit is contained in:
Akshay Gaikwad
2022-01-17 12:38:38 +05:30
parent 8464307c1e
commit 2ef237dac5
3 changed files with 514 additions and 9 deletions

View File

@@ -0,0 +1,390 @@
{
"swagger": "2.0",
"info": {
"title": "Identity Provider (IdP) Service",
"version": "2.0",
"contact": {
"name": "Rafay Dev"
}
},
"tags": [
{
"name": "Idp"
}
],
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/auth/v3/sso/idp": {
"get": {
"operationId": "Idp_ListIdps",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v3ListIdpsResponse"
}
},
"403": {
"description": "Returned when the user does not have permission to access the resource.",
"schema": {}
},
"404": {
"description": "Returned when the resource does not exist.",
"schema": {
"type": "string",
"format": "string"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
}
],
"tags": [
"Idp"
]
},
"post": {
"operationId": "Idp_CreateIdp",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v3Idp"
}
},
"201": {
"description": "Returned when idp is created successfully.",
"schema": {}
},
"403": {
"description": "Returned when the user does not have permission to access the resource.",
"schema": {}
},
"404": {
"description": "Returned when the resource does not exist.",
"schema": {
"type": "string",
"format": "string"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v3NewIdp"
}
}
],
"tags": [
"Idp"
]
}
},
"/auth/v3/sso/idp/{id}": {
"put": {
"operationId": "Idp_UpdateIdp",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v3Idp"
}
},
"403": {
"description": "Returned when the user does not have permission to access the resource.",
"schema": {}
},
"404": {
"description": "Returned when the resource does not exist.",
"schema": {
"type": "string",
"format": "string"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"acsUrl": {
"type": "string"
},
"domain": {
"type": "string"
},
"groupAttributeName": {
"type": "string"
},
"idpName": {
"type": "string"
},
"isSaeEnabled": {
"type": "boolean"
},
"metadataUrl": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
}
],
"tags": [
"Idp"
]
}
},
"/auth/v3/sso/idp/{id}/spconfig": {
"get": {
"operationId": "Idp_GetSpConfigById",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v3SpConfig"
}
},
"403": {
"description": "Returned when the user does not have permission to access the resource.",
"schema": {}
},
"404": {
"description": "Returned when the resource does not exist.",
"schema": {
"type": "string",
"format": "string"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"Idp"
]
}
}
},
"definitions": {
"googlerpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"v3Idp": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"idpName": {
"type": "string"
},
"domain": {
"type": "string"
},
"acsUrl": {
"type": "string"
},
"ssoUrl": {
"type": "string"
},
"idpCert": {
"type": "string"
},
"spCert": {
"type": "string"
},
"metadataUrl": {
"type": "string"
},
"metadataFilename": {
"type": "string"
},
"isSaeEnabled": {
"type": "boolean"
},
"groupAttributeName": {
"type": "string"
},
"organizationId": {
"type": "string"
},
"partnerId": {
"type": "string"
},
"createdAt": {
"type": "string"
},
"modifiedAt": {
"type": "string"
}
}
},
"v3ListIdpsResponse": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
},
"next": {
"type": "integer",
"format": "int32"
},
"previous": {
"type": "integer",
"format": "int32"
},
"result": {
"type": "array",
"items": {
"$ref": "#/definitions/v3Idp"
}
}
}
},
"v3NewIdp": {
"type": "object",
"properties": {
"domain": {
"type": "string"
},
"groupAttributeName": {
"type": "string"
},
"idpName": {
"type": "string"
},
"isSaeEnabled": {
"type": "boolean"
},
"name": {
"type": "string"
}
}
},
"v3SpConfig": {
"type": "object",
"properties": {
"nameidFormat": {
"type": "string"
},
"consumerBinding": {
"type": "string"
},
"acsUrl": {
"type": "string"
},
"entityId": {
"type": "string"
},
"groupAttributeName": {
"type": "string"
},
"spCert": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "X-RAFAY-API-KEYID",
"in": "header"
},
"BasicAuth": {
"type": "basic"
}
},
"security": [
{
"ApiKeyAuth": [],
"BasicAuth": []
}
]
}

View File

@@ -0,0 +1,43 @@
{
"swagger": "2.0",
"info": {
"title": "proto/types/userpb/v3/idp.proto",
"version": "version not set"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {},
"definitions": {
"googlerpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
}
}
}

View File

@@ -1,22 +1,94 @@
syntax = "proto3";
package rafay.dev.rpc.v3;
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "proto/types/userpb/v3/idp.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info : {
title : "Identity Provider (IdP) Service"
version : "2.0"
contact : {name : "Rafay Dev"}
}
schemes : HTTPS
consumes : "application/json"
produces : "application/json"
security_definitions : {
security : {
key : "BasicAuth"
value : {type : TYPE_BASIC}
}
security : {
key : "ApiKeyAuth"
value : {type : TYPE_API_KEY in : IN_HEADER name : "X-RAFAY-API-KEYID"}
}
}
security : {
security_requirement : {
key : "BasicAuth"
value : {}
}
security_requirement : {
key : "ApiKeyAuth"
value : {}
}
}
responses : {
key : "403"
value : {
description : "Returned when the user does not have permission to access "
"the resource."
}
}
responses : {
key : "404"
value : {
description : "Returned when the resource does not exist."
schema : {json_schema : {type : STRING}}
}
}
};
service Idp {
// endpoint POST /auth/v1/sso/idp
rpc CreateIdp(rafay.dev.types.user.v3.NewIdp) returns (rafay.dev.types.user.v3.Idp) {};
rpc CreateIdp(rafay.dev.types.user.v3.NewIdp) returns (rafay.dev.types.user.v3.Idp) {
option (google.api.http) = {
post : "/auth/v3/sso/idp"
body : "*"
};
// endpoint PUT /auth/v1/sso/idp
rpc UpdateIdp(rafay.dev.types.user.v3.UpdateIdp) returns (rafay.dev.types.user.v3.Idp) {};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses : {
key : "201"
value : {description : "Returned when idp is created successfully."}
}
};
};
// endpoint /auth/v1/sso/idp/dk351mn/spconfig/
rpc GetSpConfigById(rafay.dev.types.user.v3.IdpID) returns (rafay.dev.types.user.v3.SpConfig) {};
rpc UpdateIdp(rafay.dev.types.user.v3.UpdateIdp) returns (rafay.dev.types.user.v3.Idp) {
option (google.api.http) = {
put : "/auth/v3/sso/idp/{id}"
body : "*"
};
};
// endpoint /auth/v1/sso/idp/?limit=1000
rpc ListIdps(rafay.dev.types.user.v3.ListIdpsRequest) returns (rafay.dev.types.user.v3.ListIdpsResponse) {};
rpc GetSpConfigById(rafay.dev.types.user.v3.IdpID) returns (rafay.dev.types.user.v3.SpConfig) {
option (google.api.http) = {
get : "/auth/v3/sso/idp/{id}/spconfig"
};
};
// endpooint /auth/v1/sso/idp/5m16w2y/upload_metadata/
rpc ListIdps(rafay.dev.types.user.v3.ListIdpsRequest) returns (rafay.dev.types.user.v3.ListIdpsResponse) {
option (google.api.http) = {
get : "/auth/v3/sso/idp"
};
};
// DELETE /auth/v1/sso/idp/{id}/
// Delete IdP
// endpooint /auth/v1/sso/idp/{id}/upload_metadata/
// file content as request payload and response is Idp
}