{
  "openapi" : "3.1.0",
  "info" : {
    "contact" : {
      "email" : "support@priint.com",
      "name" : "priint cloud support team",
      "url" : "https://priint.com"
    },
    "description" : "REST API to authorize to priint cloud services",
    "termsOfService" : "https://www.priintcloud.com/terms",
    "title" : "priint cloud authorization service",
    "version" : "1.3.1"
  },
  "servers" : [ {
    "url" : "http://localhost:8080/auth",
    "description" : "Generated server url"
  } ],
  "paths" : {
    "/tenants/{tenant}/tokens" : {
      "post" : {
        "operationId" : "createTokenAsJson",
        "parameters" : [ {
          "description" : "Only value allowed is 'password'",
          "in" : "query",
          "name" : "grant_type"
        }, {
          "description" : "Deprecated, please use 'scope' instead",
          "in" : "query",
          "name" : "role"
        }, {
          "description" : "not in use",
          "in" : "query",
          "name" : "client_id"
        }, {
          "description" : "not in use",
          "in" : "query",
          "name" : "client_secret"
        }, {
          "deprecated" : true,
          "description" : "not in use",
          "in" : "header",
          "name" : "authorization",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        }, {
          "in" : "path",
          "name" : "tenant",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 64,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/x-www-form-urlencoded" : {
              "schema" : {
                "type" : "object",
                "properties" : {
                  "client_id" : {
                    "type" : "string"
                  },
                  "client_secret" : {
                    "type" : "string"
                  },
                  "grant_type" : {
                    "type" : "string"
                  },
                  "password" : {
                    "type" : "string",
                    "maxLength" : 128,
                    "minLength" : 8,
                    "pattern" : "^\\S.*\\S$"
                  },
                  "project" : {
                    "type" : "string",
                    "maxLength" : 64,
                    "minLength" : 1,
                    "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
                  },
                  "role" : {
                    "type" : "string",
                    "maxLength" : 64,
                    "minLength" : 1,
                    "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
                  },
                  "scope" : {
                    "type" : "string",
                    "maxLength" : 64,
                    "minLength" : 1,
                    "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
                  },
                  "username" : {
                    "type" : "string",
                    "maxLength" : 128,
                    "minLength" : 1,
                    "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*(@[a-z0-9_-]+(\\.[a-z0-9_-]+)*)?$"
                  }
                },
                "required" : [ "password", "username" ]
              }
            }
          }
        },
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/LoginResponse"
                }
              }
            },
            "description" : "OK"
          },
          "400" : {
            "content" : {
              "application/json" : {
                "example" : {
                  "timestamp" : "2023-06-13T08:47:10.447+00:00",
                  "status" : 400,
                  "error" : "Bad Request",
                  "message" : "username parameter is missing",
                  "path" : "/auth/tenants/example.com/tokens"
                }
              }
            },
            "description" : "Bad Request"
          },
          "401" : {
            "content" : {
              "application/json" : {
                "example" : {
                  "timestamp" : "2023-06-13T08:41:44.835+00:00",
                  "status" : 401,
                  "error" : "Unauthorized",
                  "message" : "",
                  "path" : "/auth/tenants/example.com/tokens"
                }
              }
            },
            "description" : "Unauthorized"
          }
        },
        "summary" : "Create tenant user token with optional project",
        "tags" : [ "tokens" ]
      }
    },
    "/tenants/{tenant}/users" : {
      "get" : {
        "operationId" : "listTenantUsers",
        "parameters" : [ {
          "in" : "path",
          "name" : "tenant",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 64,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
          }
        }, {
          "in" : "query",
          "name" : "startsWith",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "array",
                  "items" : {
                    "$ref" : "#/components/schemas/StorageItem"
                  }
                }
              }
            },
            "description" : "OK"
          }
        },
        "tags" : [ "tenant user administration" ]
      },
      "post" : {
        "operationId" : "createTenantUser",
        "parameters" : [ {
          "in" : "path",
          "name" : "tenant",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 64,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/x-www-form-urlencoded" : {
              "schema" : {
                "type" : "object",
                "properties" : {
                  "description" : {
                    "type" : "string"
                  },
                  "displayName" : {
                    "type" : "string"
                  },
                  "email" : {
                    "type" : "string"
                  },
                  "expires" : {
                    "type" : "string",
                    "format" : "date-time"
                  },
                  "password" : {
                    "type" : "string",
                    "maxLength" : 128,
                    "minLength" : 8,
                    "pattern" : "^[^\\p{Cntrl}\\s]+$"
                  },
                  "phoneNumber" : {
                    "type" : "string"
                  },
                  "project" : {
                    "type" : "array",
                    "items" : {
                      "type" : "string"
                    },
                    "uniqueItems" : true
                  },
                  "role" : {
                    "type" : "array",
                    "items" : {
                      "type" : "string"
                    },
                    "uniqueItems" : true
                  },
                  "username" : {
                    "type" : "string",
                    "maxLength" : 128,
                    "minLength" : 1,
                    "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*(@[a-z0-9_-]+(\\.[a-z0-9_-]+)*)?$"
                  }
                },
                "required" : [ "password", "role", "username" ]
              }
            }
          }
        },
        "responses" : {
          "200" : {
            "content" : {
              "*/*" : {
                "schema" : {
                  "type" : "string",
                  "format" : "uri"
                }
              }
            },
            "description" : "OK"
          }
        },
        "tags" : [ "tenant user administration" ]
      }
    },
    "/tenants/{tenant}/users/password" : {
      "post" : {
        "operationId" : "setCurrentTenantUserPassword",
        "parameters" : [ {
          "in" : "path",
          "name" : "tenant",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 64,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/x-www-form-urlencoded" : {
              "schema" : {
                "type" : "object",
                "properties" : {
                  "newpassword" : {
                    "type" : "string",
                    "maxLength" : 128,
                    "minLength" : 8,
                    "pattern" : "^[^\\p{Cntrl}\\s]+$"
                  },
                  "oldpassword" : {
                    "type" : "string",
                    "maxLength" : 128,
                    "minLength" : 8,
                    "pattern" : "^\\S.*\\S$"
                  }
                },
                "required" : [ "newpassword", "oldpassword" ]
              }
            }
          }
        },
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "boolean"
                }
              }
            },
            "description" : "OK"
          }
        },
        "tags" : [ "tenant user administration" ]
      }
    },
    "/tenants/{tenant}/users/token" : {
      "get" : {
        "operationId" : "getCurrentTenantUserToken",
        "parameters" : [ {
          "in" : "path",
          "name" : "tenant",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 64,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
          }
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/AuthInfo"
                }
              }
            },
            "description" : "OK"
          }
        },
        "tags" : [ "tenant user administration" ]
      }
    },
    "/tenants/{tenant}/users/{username}" : {
      "delete" : {
        "operationId" : "deleteTenantUser",
        "parameters" : [ {
          "in" : "path",
          "name" : "tenant",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 64,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
          }
        }, {
          "in" : "path",
          "name" : "username",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 128,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*(@[a-z0-9_-]+(\\.[a-z0-9_-]+)*)?$"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "OK"
          }
        },
        "tags" : [ "tenant user administration" ]
      },
      "get" : {
        "operationId" : "getTenantUser",
        "parameters" : [ {
          "in" : "path",
          "name" : "tenant",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 64,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
          }
        }, {
          "in" : "path",
          "name" : "username",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 128,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*(@[a-z0-9_-]+(\\.[a-z0-9_-]+)*)?$"
          }
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/UserView"
                }
              }
            },
            "description" : "OK"
          }
        },
        "tags" : [ "tenant user administration" ]
      },
      "patch" : {
        "operationId" : "patchTenantUser",
        "parameters" : [ {
          "in" : "path",
          "name" : "tenant",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 64,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
          }
        }, {
          "in" : "path",
          "name" : "username",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 128,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*(@[a-z0-9_-]+(\\.[a-z0-9_-]+)*)?$"
          }
        }, {
          "in" : "query",
          "name" : "jsonArray",
          "required" : true,
          "schema" : {
            "$ref" : "#/components/schemas/JsonArray"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "OK"
          }
        },
        "tags" : [ "tenant user administration" ]
      }
    },
    "/tenants/{tenant}/users/{username}/password" : {
      "post" : {
        "operationId" : "setTenantUserPassword",
        "parameters" : [ {
          "in" : "path",
          "name" : "tenant",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 64,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
          }
        }, {
          "in" : "path",
          "name" : "username",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 128,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*(@[a-z0-9_-]+(\\.[a-z0-9_-]+)*)?$"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/x-www-form-urlencoded" : {
              "schema" : {
                "type" : "string",
                "maxLength" : 128,
                "minLength" : 8,
                "pattern" : "^[^\\p{Cntrl}\\s]+$"
              }
            }
          }
        },
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "boolean"
                }
              }
            },
            "description" : "OK"
          }
        },
        "tags" : [ "tenant user administration" ]
      }
    },
    "/tenants/{tenant}/users/{username}/roles" : {
      "post" : {
        "operationId" : "setTenantUserRoles",
        "parameters" : [ {
          "in" : "path",
          "name" : "tenant",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 64,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
          }
        }, {
          "in" : "path",
          "name" : "username",
          "required" : true,
          "schema" : {
            "type" : "string",
            "maxLength" : 128,
            "minLength" : 1,
            "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*(@[a-z0-9_-]+(\\.[a-z0-9_-]+)*)?$"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/x-www-form-urlencoded" : {
              "schema" : {
                "type" : "object",
                "properties" : {
                  "project" : {
                    "type" : "array",
                    "items" : {
                      "type" : "string"
                    },
                    "uniqueItems" : true
                  },
                  "role" : {
                    "type" : "array",
                    "items" : {
                      "type" : "string"
                    },
                    "uniqueItems" : true
                  }
                },
                "required" : [ "role" ]
              }
            }
          }
        },
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/UserView"
                }
              }
            },
            "description" : "OK"
          }
        },
        "tags" : [ "tenant user administration" ]
      }
    },
    "/tokens" : {
      "post" : {
        "operationId" : "createToken",
        "parameters" : [ {
          "description" : "Only value allowed is 'password'",
          "in" : "query",
          "name" : "grant_type"
        }, {
          "description" : "Deprecated, please use 'scope' instead",
          "in" : "query",
          "name" : "role"
        }, {
          "description" : "not in use",
          "in" : "query",
          "name" : "client_id"
        }, {
          "description" : "not in use",
          "in" : "query",
          "name" : "client_secret"
        }, {
          "deprecated" : true,
          "description" : "not in use",
          "in" : "header",
          "name" : "authorization",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/x-www-form-urlencoded" : {
              "schema" : {
                "type" : "object",
                "properties" : {
                  "client_id" : {
                    "type" : "string"
                  },
                  "client_secret" : {
                    "type" : "string"
                  },
                  "grant_type" : {
                    "type" : "string"
                  },
                  "password" : {
                    "type" : "string",
                    "maxLength" : 128,
                    "minLength" : 8,
                    "pattern" : "^[^\\p{Cntrl}\\s]+$"
                  },
                  "project" : {
                    "type" : "string",
                    "maxLength" : 64,
                    "minLength" : 1,
                    "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
                  },
                  "role" : {
                    "type" : "string",
                    "maxLength" : 64,
                    "minLength" : 1,
                    "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
                  },
                  "scope" : {
                    "type" : "string",
                    "maxLength" : 64,
                    "minLength" : 1,
                    "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
                  },
                  "tenant" : {
                    "type" : "string",
                    "maxLength" : 64,
                    "minLength" : 1,
                    "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*$"
                  },
                  "username" : {
                    "type" : "string",
                    "maxLength" : 128,
                    "minLength" : 1,
                    "pattern" : "^[a-z0-9_-]+(\\.[a-z0-9_-]+)*(@[a-z0-9_-]+(\\.[a-z0-9_-]+)*)?$"
                  }
                },
                "required" : [ "password", "username" ]
              }
            }
          }
        },
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/LoginResponse"
                }
              }
            },
            "description" : "OK"
          },
          "400" : {
            "content" : {
              "application/json" : {
                "example" : {
                  "timestamp" : "2023-06-13T08:47:10.447+00:00",
                  "status" : 400,
                  "error" : "Bad Request",
                  "message" : "username parameter is missing",
                  "path" : "/auth/tokens"
                }
              }
            },
            "description" : "Bad Request"
          },
          "401" : {
            "content" : {
              "application/json" : {
                "example" : {
                  "timestamp" : "2023-06-13T08:41:44.835+00:00",
                  "status" : 401,
                  "error" : "Unauthorized",
                  "message" : "",
                  "path" : "/auth/tokens"
                }
              }
            },
            "description" : "Unauthorized"
          }
        },
        "summary" : "Create global user token",
        "tags" : [ "tokens" ]
      }
    }
  },
  "components" : {
    "schemas" : {
      "AuthInfo" : {
        "type" : "object",
        "properties" : {
          "expiration" : {
            "type" : "string",
            "format" : "date-time"
          },
          "project" : {
            "type" : "string"
          },
          "roles" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "uniqueItems" : true
          },
          "tenant" : {
            "type" : "string"
          },
          "user" : {
            "type" : "string"
          }
        }
      },
      "JsonArray" : {
        "type" : "array",
        "items" : {
          "$ref" : "#/components/schemas/JsonValue"
        },
        "properties" : {
          "empty" : {
            "type" : "boolean"
          },
          "first" : {
            "$ref" : "#/components/schemas/JsonValue"
          },
          "last" : {
            "$ref" : "#/components/schemas/JsonValue"
          },
          "valueType" : {
            "type" : "string",
            "enum" : [ "ARRAY", "OBJECT", "STRING", "NUMBER", "TRUE", "FALSE", "NULL" ]
          }
        }
      },
      "JsonPatch" : {
        "type" : "object"
      },
      "JsonValue" : {
        "type" : "object",
        "properties" : {
          "valueType" : {
            "type" : "string",
            "enum" : [ "ARRAY", "OBJECT", "STRING", "NUMBER", "TRUE", "FALSE", "NULL" ]
          }
        }
      },
      "LoginResponse" : {
        "type" : "object",
        "properties" : {
          "access_token" : {
            "type" : "string"
          },
          "expires_in" : {
            "type" : "integer",
            "format" : "int32"
          },
          "refresh_token" : {
            "type" : "string"
          },
          "scope" : {
            "type" : "string"
          },
          "token_type" : {
            "type" : "string"
          }
        }
      },
      "Project" : {
        "type" : "object",
        "properties" : {
          "name" : {
            "type" : "string"
          },
          "roles" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "uniqueItems" : true
          }
        }
      },
      "StorageItem" : {
        "type" : "object",
        "properties" : {
          "entityTag" : {
            "type" : "string"
          },
          "isDirectory" : {
            "type" : "boolean"
          },
          "lastModified" : {
            "type" : "string",
            "format" : "date-time"
          },
          "path" : {
            "type" : "string"
          },
          "properties" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "string"
            }
          },
          "size" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "UserView" : {
        "type" : "object",
        "properties" : {
          "active" : {
            "type" : "boolean"
          },
          "description" : {
            "type" : "string"
          },
          "displayName" : {
            "type" : "string"
          },
          "email" : {
            "type" : "string"
          },
          "expires" : {
            "type" : "string",
            "format" : "date-time"
          },
          "lastModified" : {
            "type" : "string",
            "format" : "date-time"
          },
          "name" : {
            "type" : "string"
          },
          "phoneNumber" : {
            "type" : "string"
          },
          "projects" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/Project"
            },
            "uniqueItems" : true
          },
          "roles" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "uniqueItems" : true
          }
        }
      }
    },
    "securitySchemes" : {
      "oauth2-root-token" : {
        "description" : "Create a root user token without tenant and project",
        "flows" : {
          "password" : {
            "scopes" : {
              "admin" : ""
            },
            "tokenUrl" : "https://api.priintcloud.com/auth/tokens"
          }
        },
        "type" : "oauth2"
      }
    }
  }
}