Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
federation: Add OpenAPI spec
Signed-off-by: jld3103 <[email protected]>
  • Loading branch information
provokateurin committed Jul 3, 2023
commit 5d4e24346b5d70d7441f9bd0771edf884211efe5
20 changes: 16 additions & 4 deletions apps/federation/lib/Controller/OCSAuthAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ public function __construct(
*
* @NoCSRFRequired
* @PublicPage
* @throws OCSForbiddenException
*
* @param string $url URL of the server
* @param string $token Token of the server
* @throws OCSForbiddenException Requesting shared secret is not allowed
*/
public function requestSharedSecretLegacy(string $url, string $token): DataResponse {
return $this->requestSharedSecret($url, $token);
Expand All @@ -91,7 +94,10 @@ public function requestSharedSecretLegacy(string $url, string $token): DataRespo
*
* @NoCSRFRequired
* @PublicPage
* @throws OCSForbiddenException
*
* @param string $url URL of the server
* @param string $token Token of the server
* @throws OCSForbiddenException Getting shared secret is not allowed
*/
public function getSharedSecretLegacy(string $url, string $token): DataResponse {
return $this->getSharedSecret($url, $token);
Expand All @@ -102,7 +108,10 @@ public function getSharedSecretLegacy(string $url, string $token): DataResponse
*
* @NoCSRFRequired
* @PublicPage
* @throws OCSForbiddenException
*
* @param string $url URL of the server
* @param string $token Token of the server
* @throws OCSForbiddenException Requesting shared secret is not allowed
*/
public function requestSharedSecret(string $url, string $token): DataResponse {
if ($this->trustedServers->isTrustedServer($url) === false) {
Expand Down Expand Up @@ -138,7 +147,10 @@ public function requestSharedSecret(string $url, string $token): DataResponse {
*
* @NoCSRFRequired
* @PublicPage
* @throws OCSForbiddenException
*
* @param string $url URL of the server
* @param string $token Token of the server
* @throws OCSForbiddenException Getting shared secret is not allowed
*/
public function getSharedSecret(string $url, string $token): DataResponse {
if ($this->trustedServers->isTrustedServer($url) === false) {
Expand Down
291 changes: 291 additions & 0 deletions apps/federation/openapi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
{
"openapi": "3.0.3",
"info": {
"title": "federation",
"version": "0.0.1",
"description": "Federation allows you to connect with other trusted servers to exchange the user directory.",
"license": {
"name": "agpl"
}
},
"components": {
"securitySchemes": {
"basic_auth": {
"type": "http",
"scheme": "basic"
},
"bearer_auth": {
"type": "http",
"scheme": "bearer"
}
},
"schemas": {
"OCSMeta": {
"type": "object",
"required": [
"status",
"statuscode"
],
"properties": {
"status": {
"type": "string"
},
"statuscode": {
"type": "integer"
},
"message": {
"type": "string"
},
"totalitems": {
"type": "string"
},
"itemsperpage": {
"type": "string"
}
}
}
}
},
"paths": {
"/ocs/v2.php/apps/federation/api/v1/shared-secret": {
"get": {
"operationId": "ocs_authapi-get-shared-secret-legacy",
"summary": "Create shared secret and return it, for legacy end-points",
"tags": [
"ocs_authapi"
],
"security": [
{},
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "url",
"in": "query",
"description": "URL of the server",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "token",
"in": "query",
"description": "Token of the server",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"required": true,
"schema": {
"type": "string",
"default": "true"
}
}
],
"responses": {
"403": {
"description": "Getting shared secret is not allowed",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/ocs/v2.php/apps/federation/api/v1/request-shared-secret": {
"post": {
"operationId": "ocs_authapi-request-shared-secret-legacy",
"summary": "Request received to ask remote server for a shared secret, for legacy end-points",
"tags": [
"ocs_authapi"
],
"security": [
{},
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "url",
"in": "query",
"description": "URL of the server",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "token",
"in": "query",
"description": "Token of the server",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"required": true,
"schema": {
"type": "string",
"default": "true"
}
}
],
"responses": {
"403": {
"description": "Requesting shared secret is not allowed",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/ocs/v2.php/cloud/shared-secret": {
"get": {
"operationId": "ocs_authapi-get-shared-secret",
"summary": "Create shared secret and return it",
"tags": [
"ocs_authapi"
],
"security": [
{},
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "url",
"in": "query",
"description": "URL of the server",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "token",
"in": "query",
"description": "Token of the server",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"required": true,
"schema": {
"type": "string",
"default": "true"
}
}
],
"responses": {
"403": {
"description": "Getting shared secret is not allowed",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
},
"post": {
"operationId": "ocs_authapi-request-shared-secret",
"summary": "Request received to ask remote server for a shared secret",
"tags": [
"ocs_authapi"
],
"security": [
{},
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "url",
"in": "query",
"description": "URL of the server",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "token",
"in": "query",
"description": "Token of the server",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"required": true,
"schema": {
"type": "string",
"default": "true"
}
}
],
"responses": {
"403": {
"description": "Requesting shared secret is not allowed",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
},
"tags": [
{
"name": "ocs_authapi",
"description": "Class OCSAuthAPI\nOCS API end-points to exchange shared secret between two connected Nextclouds"
}
]
}