From 95385cc2b1a729b1107f9c965f52fce2894a1be5 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Wed, 15 Jul 2020 14:04:25 -0500 Subject: [PATCH 01/29] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e17e7b6..0e4c3e11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + ## [1.6.0] - 2020-07-14 ### Added - Add Health Building Block APIs documentation. [#468](https://github.com/rokwire/rokwire-building-blocks-api/issues/468) From b69612d6307ff16431cf08253baa1548ffc95d04 Mon Sep 17 00:00:00 2001 From: Bing Zhang Date: Wed, 15 Jul 2020 14:59:33 -0500 Subject: [PATCH 02/29] Add standard license header for events building block (#494) * license file for events building block * Update CHANGELOG.md Co-authored-by: Sandeep Puthanveetil Satheesan * update Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 3 ++- eventservice/__init__.py | 14 ++++++++++++++ eventservice/api/__init__.py | 14 ++++++++++++++ eventservice/api/controllers/__init__.py | 14 ++++++++++++++ eventservice/api/controllers/configs.py | 14 ++++++++++++++ eventservice/api/controllers/events.py | 14 ++++++++++++++ eventservice/api/controllers/images/__init__.py | 14 ++++++++++++++ eventservice/api/controllers/images/localfile.py | 14 ++++++++++++++ eventservice/api/controllers/images/s3.py | 14 ++++++++++++++ eventservice/api/events_rest_service.py | 14 ++++++++++++++ eventservice/api/gunicorn.config.py | 14 ++++++++++++++ eventservice/api/models/__init__.py | 14 ++++++++++++++ eventservice/api/rokwireresolver.py | 14 ++++++++++++++ eventservice/api/utils/__init__.py | 14 ++++++++++++++ eventservice/api/utils/cache.py | 14 ++++++++++++++ eventservice/api/utils/db.py | 14 ++++++++++++++ eventservice/api/utils/query_params.py | 14 ++++++++++++++ release_events.sh | 0 18 files changed, 226 insertions(+), 1 deletion(-) mode change 100644 => 100755 release_events.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e4c3e11..586e7841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Add Standard License Header for Events Building Block. [#480](https://github.com/rokwire/rokwire-building-blocks-api/issues/480) ## [1.6.0] - 2020-07-14 -### Added - Add Health Building Block APIs documentation. [#468](https://github.com/rokwire/rokwire-building-blocks-api/issues/468) - Code of Conduct. [#487](https://github.com/rokwire/rokwire-building-blocks-api/issues/487) diff --git a/eventservice/__init__.py b/eventservice/__init__.py index e69de29b..21531846 100644 --- a/eventservice/__init__.py +++ b/eventservice/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/eventservice/api/__init__.py b/eventservice/api/__init__.py index e69de29b..21531846 100644 --- a/eventservice/api/__init__.py +++ b/eventservice/api/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/eventservice/api/controllers/__init__.py b/eventservice/api/controllers/__init__.py index e69de29b..21531846 100644 --- a/eventservice/api/controllers/__init__.py +++ b/eventservice/api/controllers/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/eventservice/api/controllers/configs.py b/eventservice/api/controllers/configs.py index 8494cb60..6efecf5d 100644 --- a/eventservice/api/controllers/configs.py +++ b/eventservice/api/controllers/configs.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import os import ast from dotenv import load_dotenv diff --git a/eventservice/api/controllers/events.py b/eventservice/api/controllers/events.py index e6ba0f3e..805bbcce 100644 --- a/eventservice/api/controllers/events.py +++ b/eventservice/api/controllers/events.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import io import os import json diff --git a/eventservice/api/controllers/images/__init__.py b/eventservice/api/controllers/images/__init__.py index e69de29b..21531846 100644 --- a/eventservice/api/controllers/images/__init__.py +++ b/eventservice/api/controllers/images/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/eventservice/api/controllers/images/localfile.py b/eventservice/api/controllers/images/localfile.py index dc006713..1d8ee0b2 100644 --- a/eventservice/api/controllers/images/localfile.py +++ b/eventservice/api/controllers/images/localfile.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import os import shutil import tempfile diff --git a/eventservice/api/controllers/images/s3.py b/eventservice/api/controllers/images/s3.py index 7c4f58a1..0e489ba5 100644 --- a/eventservice/api/controllers/images/s3.py +++ b/eventservice/api/controllers/images/s3.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import os import tempfile import boto3 diff --git a/eventservice/api/events_rest_service.py b/eventservice/api/events_rest_service.py index 0f34582d..77ea58f0 100644 --- a/eventservice/api/events_rest_service.py +++ b/eventservice/api/events_rest_service.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import connexion import controllers.configs as cfg from utils.db import init_db diff --git a/eventservice/api/gunicorn.config.py b/eventservice/api/gunicorn.config.py index 2fc91b5c..549b839e 100644 --- a/eventservice/api/gunicorn.config.py +++ b/eventservice/api/gunicorn.config.py @@ -1,5 +1,19 @@ """Gunicorn configuration.""" +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + bind = '0.0.0.0:5000' workers = 4 diff --git a/eventservice/api/models/__init__.py b/eventservice/api/models/__init__.py index e69de29b..21531846 100644 --- a/eventservice/api/models/__init__.py +++ b/eventservice/api/models/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/eventservice/api/rokwireresolver.py b/eventservice/api/rokwireresolver.py index 0f32c13f..7ca34986 100644 --- a/eventservice/api/rokwireresolver.py +++ b/eventservice/api/rokwireresolver.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import re from connexion import Resolver diff --git a/eventservice/api/utils/__init__.py b/eventservice/api/utils/__init__.py index e69de29b..21531846 100644 --- a/eventservice/api/utils/__init__.py +++ b/eventservice/api/utils/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/eventservice/api/utils/cache.py b/eventservice/api/utils/cache.py index 4842e281..02a140dd 100644 --- a/eventservice/api/utils/cache.py +++ b/eventservice/api/utils/cache.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import bson.json_util import diskcache import json diff --git a/eventservice/api/utils/db.py b/eventservice/api/utils/db.py index 234ebba0..eda1885c 100644 --- a/eventservice/api/utils/db.py +++ b/eventservice/api/utils/db.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from flask import current_app, g import pymongo from pymongo.mongo_client import MongoClient diff --git a/eventservice/api/utils/query_params.py b/eventservice/api/utils/query_params.py index f98ad441..382deba2 100644 --- a/eventservice/api/utils/query_params.py +++ b/eventservice/api/utils/query_params.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import datetime import re from bson import ObjectId diff --git a/release_events.sh b/release_events.sh old mode 100644 new mode 100755 From 9bb1985506a916f1cebe73f3080a3a978a9012fa Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Thu, 16 Jul 2020 16:29:09 -0500 Subject: [PATCH 03/29] Task/485 split rokwire yaml across different building blocks (#490) * Use separate OpenAPI specification file for Profile Building Block. * Use separate OpenAPI specification file for Logging Building Block. * Use separate OpenAPI specification file for Events Building Block. * Use separate OpenAPI specification file for Auth Building Block. Other minor updates. * Use separate OpenAPI specification file for App Config Building Block. * Update CHANGELOG. --- CHANGELOG.md | 3 + appconfigservice/Dockerfile | 2 +- .../api/appconfig_rest_service.py | 2 +- appconfigservice/api/controllers/config.py | 2 +- appconfigservice/api/test/test_app_config.py | 2 +- appconfigservice/appconfig.yaml | 271 ++++++ authservice/{openapi.yaml => auth.yaml} | 6 +- authservice/auth_rest_service.py | 10 +- eventservice/Dockerfile | 2 +- eventservice/README.md | 2 +- eventservice/api/controllers/configs.py | 2 +- eventservice/api/events_rest_service.py | 2 +- eventservice/events.yaml | 837 ++++++++++++++++++ loggingservice/Dockerfile | 2 +- loggingservice/README.md | 2 +- loggingservice/api/controllers/config.py | 2 +- loggingservice/api/logging_rest_service.py | 2 +- loggingservice/logging.yaml | 145 +++ profileservice/Dockerfile | 2 +- profileservice/README.md | 2 +- profileservice/api/controllers/configs.py | 2 +- profileservice/api/profile_rest_service.py | 2 +- profileservice/profile.yaml | 626 +++++++++++++ 23 files changed, 1906 insertions(+), 24 deletions(-) create mode 100755 appconfigservice/appconfig.yaml rename authservice/{openapi.yaml => auth.yaml} (96%) create mode 100755 eventservice/events.yaml create mode 100755 loggingservice/logging.yaml create mode 100755 profileservice/profile.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 586e7841..6cb75b6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add Standard License Header for Events Building Block. [#480](https://github.com/rokwire/rokwire-building-blocks-api/issues/480) +### Changed +- OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) + ## [1.6.0] - 2020-07-14 - Add Health Building Block APIs documentation. [#468](https://github.com/rokwire/rokwire-building-blocks-api/issues/468) - Code of Conduct. [#487](https://github.com/rokwire/rokwire-building-blocks-api/issues/487) diff --git a/appconfigservice/Dockerfile b/appconfigservice/Dockerfile index de95537c..a9d8198e 100644 --- a/appconfigservice/Dockerfile +++ b/appconfigservice/Dockerfile @@ -6,7 +6,7 @@ WORKDIR /app COPY appconfigservice ./appconfigservice COPY lib ../lib/ -COPY rokwire.yaml . +COPY appconfigservice/appconfig.yaml . ENV APP_CONFIG_MONGO_URL="" ENV APP_CONFIG_URL_PREFIX="" diff --git a/appconfigservice/api/appconfig_rest_service.py b/appconfigservice/api/appconfig_rest_service.py index 3c700bc9..d35d10ca 100644 --- a/appconfigservice/api/appconfig_rest_service.py +++ b/appconfigservice/api/appconfig_rest_service.py @@ -38,7 +38,7 @@ db.init_db() app = connexion.FlaskApp(__name__, specification_dir=API_LOC) -app.add_api('rokwire.yaml', base_path=APP_CONFIG_URL_PREFIX, arguments={'title': 'Rokwire'}, +app.add_api('appconfig.yaml', base_path=APP_CONFIG_URL_PREFIX, arguments={'title': 'Rokwire'}, resolver=RokwireResolver('controllers'), resolver_error=501) diff --git a/appconfigservice/api/controllers/config.py b/appconfigservice/api/controllers/config.py index 68f29698..145b6446 100644 --- a/appconfigservice/api/controllers/config.py +++ b/appconfigservice/api/controllers/config.py @@ -25,6 +25,6 @@ APP_CONFIG_URL_PREFIX = os.getenv('APP_CONFIG_URL_PREFIX', '') APP_CONFIGS_COLLECTION = os.getenv('APP_CONFIG_MONGO_COLLECTION_NAME','app_configs') -API_LOC = os.getenv('API_LOC', '../../') +API_LOC = os.getenv('API_LOC', '../') # APP_CONFIG_ENDPOINT = os.getenv('APPCONFIG_ENDPOINT', '/rest_service') DEBUG = bool(os.getenv('DEBUG', 'False') == 'True') diff --git a/appconfigservice/api/test/test_app_config.py b/appconfigservice/api/test/test_app_config.py index 640f0a38..81f69459 100644 --- a/appconfigservice/api/test/test_app_config.py +++ b/appconfigservice/api/test/test_app_config.py @@ -28,7 +28,7 @@ def app(): """Create and configure a new api instance for each test.""" app = connexion.FlaskApp(__name__, specification_dir=API_LOC) - app.add_api('rokwire.yaml', arguments={'title': 'Rokwire'}, resolver=RokwireResolver('controllers'), + app.add_api('appconfig.yaml', arguments={'title': 'Rokwire'}, resolver=RokwireResolver('controllers'), resolver_error=501) yield app diff --git a/appconfigservice/appconfig.yaml b/appconfigservice/appconfig.yaml new file mode 100755 index 00000000..f4fe84ea --- /dev/null +++ b/appconfigservice/appconfig.yaml @@ -0,0 +1,271 @@ +openapi: 3.0.0 +info: + title: Rokwire App Config Building Block API + description: App Config Building Block API Documentation + version: 1.5.0 +servers: +- url: https://api.rokwire.illinois.edu + description: Production server +- url: https://api-test.rokwire.illinois.edu + description: Test server +- url: https://api-dev.rokwire.illinois.edu + description: Development server +tags: +- name: App Configuration + description: API endpoints for managing mobile app configuration + +paths: + /app/configs: + post: + tags: + - App Configuration + summary: Creates mobile app configuration + description: | + Auth: Requires a valid id_token that indicates membership in the following group\: + + ```urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire app config manager``` + security: + - UserAuth: [] + requestBody: + description: Creates AppConfig object + content: + application/json: + schema: + $ref: '#/components/schemas/AppConfig' + examples: + withoutSecretKeys: + value: + mobileAppVersion: "1.0.1" + platformBuildingBlocks: + appconfig: https://api.rokwire.illinois.edu/app/configs + profile: https://api.rokwire.illinois.edu/profiles + thirdPartyServices: + facebook: https://facebook.com + instagram_url: https://instagram.com + otherUniversityServices: + illini_cash_base_url: https://shibtest.housing.illinois.edu/MobileAppWS/api + secretKeys: "" + upgrade: + available_version: "1.0.2" + required_version: "1.0.0" + "url": + "android": "market://details?id=com.dropbox.android" + "ios": "itms-apps://itunes.apple.com/us/app/apple-store/id327630330" + withSecretKeys: + value: + mobileAppVersion: "1.0.2" + platformBuildingBlocks: + appconfig: https://api.rokwire.illinois.edu/app/configs + profile: https://api.rokwire.illinois.edu/profiles + thirdPartyServices: + facebook: https://facebook.com + instagram_url: https://instagram.com + otherUniversityServices: + illini_cash_base_url: https://shibtest.housing.illinois.edu/MobileAppWS/api + secretKeys: "123abc456" + upgrade: + available_version: "1.0.2" + required_version: "1.0.0" + "url": + "android": "market://details?id=com.dropbox.android" + "ios": "itms-apps://itunes.apple.com/us/app/apple-store/id327630330" + required: true + responses: + 201: + description: AppConfig created + content: + application/json: + schema: + $ref: '#/components/schemas/AppConfig' + 400: + description: Bad request + 401: + description: Unauthorized + 500: + description: Internal error + get: + tags: + - App Configuration + summary: Reads mobile app configuration + description: | + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + parameters: + - name: mobileAppVersion + in: query + description: query by mobile app version, results contain all app configurations if no paramer is given; If given mobileAppVersion, it will return the closest app config that is less than or equal to the given version. + style: form + explode: false + schema: + type: string + responses: + 200: + description: successfully read mobile app configuration + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/AppConfig' + 400: + description: Bad request. + 401: + description: Unauthorized + 404: + description: AppConfig not found + 500: + description: Internal error + /app/configs/{id}: + get: + tags: + - App Configuration + summary: Reads mobile app configuration by given id + description: | + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + parameters: + - name: id + in: path + description: app config id to read + required: true + style: simple + explode: false + schema: + type: string + responses: + 200: + description: successfully read mobile app configuration + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/AppConfig' + 400: + description: Bad request. + 401: + description: Unauthorized + 404: + description: AppConfig not found + 500: + description: Internal error + put: + tags: + - App Configuration + summary: Updates mobile app configuration + description: | + Auth: Requires a valid id_token that indicates membership in the following group\: + + ```urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire app config manager``` + security: + - UserAuth: [] + parameters: + - name: id + in: path + description: app config id to update + required: true + style: simple + explode: false + schema: + type: string + requestBody: + description: update AppConfig object + content: + application/json: + schema: + $ref: '#/components/schemas/AppConfig' + required: true + responses: + 200: + description: successfully updated mobile app configuration + content: + application/json: + schema: + $ref: '#/components/schemas/AppConfig' + 401: + description: Unauthorized + 405: + description: Invalid input + 500: + description: Internal error + delete: + tags: + - App Configuration + summary: Deletes mobile app configuration + description: | + Auth: Requires a valid id_token that indicates membership in the following group\: + + ```urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire app config manager``` + security: + - UserAuth: [] + parameters: + - name: id + in: path + description: app config id to delete + required: true + style: simple + explode: false + schema: + type: string + responses: + 202: + description: AppConfig deleted + 401: + description: Unauthorized + 404: + description: AppConfig not found + 500: + description: Internal error +components: + schemas: + AppConfig: + type: object + properties: + id: + type: string + mobileAppVersion: + type: string + description: unique and is empty or conforms major.minor.patch format + platformBuildingBlocks: + type: object + thirdPartyServices: + type: object + otherUniversityServices: + type: object + secretKeys: + type: string + upgrade: + type: object + properties: + available_version: + type: string + required_version: + type: string + url: + type: object + properties: + android: + type: string + ios: + type: string + required: + - mobileAppVersion + - platformBuildingBlocks + - thirdPartyServices + - otherUniversityServices + - secretKeys + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: ROKWIRE-API-KEY + x-apikeyInfoFunc: auth_middleware.verify_apikey + description: Each client version has unique API key (e.g., "c6befa22-50a6-4403-a8fc-378c9719743b"). For API endpoints that do not require user authentication, the ROKWIRE-API-KEY header must contain an API key corresponding to a supported client. + UserAuth: + type: http + scheme: bearer + bearerFormat: JWT # https://openid.net/specs/openid-connect-core-1_0.html [id_token] + x-bearerInfoFunc: auth_middleware.verify_userauth + description: The client must send a valid (i.e., signed, not expired) OpenID Connect id_token in the Authorization header when making requests to API endpoints that require user authentication. diff --git a/authservice/openapi.yaml b/authservice/auth.yaml similarity index 96% rename from authservice/openapi.yaml rename to authservice/auth.yaml index 91fffa2f..8a7149a2 100644 --- a/authservice/openapi.yaml +++ b/authservice/auth.yaml @@ -1,8 +1,8 @@ openapi: 3.0.2 info: - title: rokwire-auth - description: rokwire auth - version: "0.1.0alpha" + title: Rokwire Auth Building Block API + description: Authentication Building Block API Documentation + version: "1.5.0" paths: /authentication/phone-initiate: post: diff --git a/authservice/auth_rest_service.py b/authservice/auth_rest_service.py index d4e5f986..73ec8877 100644 --- a/authservice/auth_rest_service.py +++ b/authservice/auth_rest_service.py @@ -120,16 +120,16 @@ def verification_check(): def ping(): return { - 'message': "if you beat me at ping pong, I'll just play ping ponger", + "message": "success", } -app = connexion.FlaskApp(__name__, debug=True) +app = connexion.FlaskApp(__name__) # create the bindings, if you use demo2.yaml you will need to use ApiResolver app.add_api( - 'openapi.yaml', - arguments={'title': 'rokwire-auth'}, + 'auth.yaml', + arguments={'title': 'Rokwire Auth'}, # resolver=connexion.RestyResolver('auth_rest_service'), resolver_error=501, ) @@ -148,4 +148,4 @@ def ping(): if __name__ == '__main__': # start the application, in debug mode this will auto reload. - app.run(port=5000, host=None, server='flask', debug=True) + app.run(port=5000, host=None, server='flask') diff --git a/eventservice/Dockerfile b/eventservice/Dockerfile index 4a5abb43..82a6e9b9 100644 --- a/eventservice/Dockerfile +++ b/eventservice/Dockerfile @@ -5,7 +5,7 @@ LABEL maintainer="bing@illinois.edu" RUN mkdir -p /app/eventservice/events-images/ WORKDIR /app -COPY rokwire.yaml /app/ +COPY eventservice/events.yaml /app/ COPY eventservice /app/eventservice/ COPY lib /lib/ RUN pip install -r /app/eventservice/requirements.txt diff --git a/eventservice/README.md b/eventservice/README.md index 7482d722..aff04eb9 100644 --- a/eventservice/README.md +++ b/eventservice/README.md @@ -43,7 +43,7 @@ cd rokwire-building-blocks-api/eventservice python api/events_rest_service.py ``` and the Events Building Block should be running at localhost at port 5000 (http://localhost:5000/events). -The detailed API information is in rokwire.yaml in the OpenAPI Spec 3.0 format. +The detailed API information is in events.yaml in the OpenAPI Spec 3.0 format. ## Run as Docker Container in Local ``` diff --git a/eventservice/api/controllers/configs.py b/eventservice/api/controllers/configs.py index 6efecf5d..5b3f9334 100644 --- a/eventservice/api/controllers/configs.py +++ b/eventservice/api/controllers/configs.py @@ -19,7 +19,7 @@ # Load .env file load_dotenv() -API_LOC = os.getenv('API_LOC', '../../') +API_LOC = os.getenv('API_LOC', '../') DEBUG = bool(os.getenv('DEBUG', 'False') == 'True') EVENT_MONGO_URL = os.getenv("EVENT_MONGO_URL", "mongodb://localhost:27017") diff --git a/eventservice/api/events_rest_service.py b/eventservice/api/events_rest_service.py index 77ea58f0..d0eeee41 100644 --- a/eventservice/api/events_rest_service.py +++ b/eventservice/api/events_rest_service.py @@ -22,7 +22,7 @@ init_db() app = connexion.FlaskApp(__name__, debug=debug, specification_dir=cfg.API_LOC) -app.add_api('rokwire.yaml', base_path=cfg.URL_PREFIX, arguments={'title': 'Rokwire'}, resolver=RokwireResolver('controllers'), +app.add_api('events.yaml', base_path=cfg.URL_PREFIX, arguments={'title': 'Rokwire'}, resolver=RokwireResolver('controllers'), resolver_error=501) if __name__ == '__main__': diff --git a/eventservice/events.yaml b/eventservice/events.yaml new file mode 100755 index 00000000..b258bb01 --- /dev/null +++ b/eventservice/events.yaml @@ -0,0 +1,837 @@ +openapi: 3.0.0 +info: + title: Rokwire Events Building Block API + description: Events Building Block API Documentation + version: 1.5.0 +servers: +- url: https://api.rokwire.illinois.edu + description: Production server +- url: https://api-test.rokwire.illinois.edu + description: Test server +- url: https://api-dev.rokwire.illinois.edu + description: Development server +tags: +- name: Events + description: API endpoints for managing events. +paths: + /events: + get: + tags: + - Events + summary: searches events + description: | + By passing in the appropriate options, you can search for events matching your criteria in the system + + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + parameters: + - name: title + in: query + description: The parameter for searching events based on keywords in the title. + required: false + style: form + explode: true + schema: + type: string + - name: recurrenceId + in: query + description: The parameter to search events based on a specific recurrence ID. + required: false + style: form + explode: true + schema: + type: integer + - name: tags + in: query + description: Search events with the given tags, e.g., /events?tags=coffee&tags=music. This query will return all events whose tags contain coffee or music + required: false + style: form + explode: true + schema: + type: string + - name: targetAudience + in: query + description: The parameter for searching events based on given input target audience, e.g., /events?targetAudience=students&targetAudience=staff. This query will return all events whose target audience is either students or staff. This parameter is CURRENTLY IGNORED. + required: false + style: form + explode: true + schema: + type: string + - name: startDate + in: query + description: The parameter for searching events based on a given start date, e.g., /events?startDate=2019-04-25T13:00:00. This query will return all events whose start date is equal or after the given input date. + required: false + style: form + explode: true + schema: + type: string + - name: endDate + in: query + description: The parameter for searching events based on a given end date, e.g., /events?endDate=2019-04-25T13:00:00. This query will return all events whose start date is equal or before the given input date. + required: false + style: form + explode: true + schema: + type: string + - name: latitude + in: query + description: The latitude of the center point for geolocation radius search. + required: false + style: form + explode: true + schema: + type: number + - name: longitude + in: query + description: The longitude of the center point for geolocation radius search. + required: false + style: form + explode: true + schema: + type: number + - name: radius + in: query + description: The parameter to search events within a given radius of the provided location in meters, e.g., /events?latitude=40.1078955&longitude=-88.224036&radius=800. This query will return back all events whose geolocation is within 800 meter centered at given geolocation point. + required: false + style: form + explode: true + schema: + type: integer + - name: skip + in: query + description: number of records to skip for pagination + required: false + style: form + explode: true + schema: + minimum: 0 + type: integer + format: int32 + - name: limit + in: query + description: maximum number of records to return + required: false + style: form + explode: true + schema: + maximum: 50 + minimum: 0 + type: integer + format: int32 + - name: id + in: query + description: The parameter for searching multiple events based on their IDs. + required: false + style: form + explode: true + schema: + type: string + - name: superEventId + in: query + description: The parameter for searching sub events based on the ID of a super event. + required: false + style: form + explode: true + schema: + type: string + responses: + 200: + description: search results matching criteria + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Event' + + 401: + description: Unauthorized + 404: + description: Event not found + 500: + description: Internal error + post: + tags: + - Events + summary: create an event + description: | + create an event record into the system + + Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: + ``` + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers + ``` + security: + - UserAuth: [] + requestBody: + description: Created event object + content: + application/json: + schema: + $ref: '#/components/schemas/Event' + required: true + responses: + 201: + description: Events created + content: + application/json: + schema: + $ref: '#/components/schemas/Event' + 400: + description: Bad request + 401: + description: Unauthorized + 500: + description: Internal error + /events/{event_id}: + get: + tags: + - Events + summary: Get one event by the given event id. + description: | + Get the event record matching the eventId. + + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + parameters: + - name: event_id + in: path + description: ID of the event that needs to be updated + required: true + style: simple + explode: false + schema: + type: string + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Event' + application/xml: + schema: + $ref: '#/components/schemas/Event' + 400: + description: Invalid ID supplied + 401: + description: Unauthorized + 500: + description: Internal error + put: + tags: + - Events + summary: Updates one event with form data + description: | + Update the event record matching the eventId. + + Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: + ``` + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers + ``` + security: + - UserAuth: [] + parameters: + - name: event_id + in: path + description: ID of the event that needs to be updated + required: true + style: simple + explode: false + schema: + type: string + requestBody: + description: update one event object + content: + application/json: + schema: + $ref: '#/components/schemas/Event' + required: true + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Event' + application/xml: + schema: + $ref: '#/components/schemas/Event' + 400: + description: Invalid ID supplied + 401: + description: Unauthorized + 405: + description: Invalid input + 500: + description: Internal error + delete: + tags: + - Events + summary: Deletes an event by the given event id + description: | + Delete the event record matching the eventId. + + Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: + ``` + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers + ``` + security: + - UserAuth: [] + parameters: + - name: event_id + in: path + description: event id to delete + required: true + style: simple + explode: false + schema: + type: string + responses: + 202: + description: Event is deleted + 400: + description: Invalid ID supplied + 401: + description: Unauthorized + 404: + description: Event not found + patch: + tags: + - Events + summary: Updates one event with form data + description: | + Update the event record matching the eventId. + + Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: + ``` + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers + ``` + security: + - UserAuth: [] + parameters: + - name: event_id + in: path + description: ID of the event that needs to be updated + required: true + style: simple + explode: false + schema: + type: string + requestBody: + description: patch one event object + content: + application/json: + schema: + $ref: '#/components/schemas/Event' + required: true + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Event' + application/xml: + schema: + $ref: '#/components/schemas/Event' + 400: + description: Invalid ID supplied + 401: + description: Unauthorized + 405: + description: Invalid input + 500: + description: Internal error + /events/categories: + get: + tags: + - Events + summary: Get events categories + description: | + return back a list of categories and subcategories + + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + responses: + 200: + description: search results matching criteria + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Categories' + + 401: + description: Unauthorized + 404: + description: Event not found + 500: + description: Internal error + /events/tags: + get: + tags: + - Events + summary: Get a list of Rokwire event tags + description: | + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + responses: + 200: + description: Getting event tags successful + content: + application/json: + schema: + type: array + items: + type: string + 500: + description: Internal error + /events/super-events/tags: + get: + tags: + - Events + summary: Get a list of Rokwire super event tags + description: | + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + responses: + 200: + description: Getting super event tags successful + content: + application/json: + schema: + type: array + items: + type: string + 500: + description: Internal error + /events/{event_id}/images: + get: + tags: + - Events + summary: Get IDs of all images associated with the requested event. + description: | + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + parameters: + - name: event_id + in: path + description: Event ID + required: true + schema: + type: string + responses: + 200: + description: Getting image IDs successful. + content: + multipart/form-data: + schema: + type: array + items: + type: string + format: binary + 500: + description: Internal error + post: + tags: + - Events + summary: Upload an image to the specified event + description: | + Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: + ``` + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers + ``` + security: + - UserAuth: [] + requestBody: + description: Image file to upload and associate with the requested event + content: + image/*: + schema: + type: string + format: binary + minLength: 1 + maxLength: 5000000 + parameters: + - name: event_id + in: path + description: Event ID + required: true + schema: + type: string + responses: + 201: + description: Images uploaded + content: + application/json: + schema: + type: object + properties: + status: + type: integer + description: Operation status code + id: + type: integer + format: int64 + description: Image ID + message: + type: string + description: The description of the operation + 500: + description: Internal error + /events/{event_id}/images/{image_id}: + get: + tags: + - Events + summary: Download an event image by providing the IDs of the event and the image. + description: | + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + parameters: + - name: event_id + in: path + description: Event ID + required: true + schema: + type: string + - name: image_id + in: path + description: Requested image ID + required: true + schema: + type: string + responses: + 200: + description: Successful image download + content: + image/jpeg: + schema: + type: string + format: binary + 500: + description: Internal Error + + put: + tags: + - Events + summary: Update an image associated with the specified event + description: | + Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: + ``` + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers + ``` + security: + - UserAuth: [] + requestBody: + description: Image file to add to the event + content: + image/*: + schema: + type: string + format: binary + minLength: 1 + maxLength: 5000000 + parameters: + - name: event_id + in: path + description: Event ID + required: true + schema: + type: string + - name: image_id + in: path + description: Requested image ID + required: true + schema: + type: string + responses: + 200: + description: Image updated + content: + application/json: + schema: + type: object + properties: + status: + type: integer + description: Operation status code + id: + type: integer + format: int64 + description: Event ID + message: + type: string + description: The description of the operation + 500: + description: Internal error + + delete: + tags: + - Events + summary: Delete an image associated with the specified event + description: | + Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: + ``` + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app + urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers + ``` + security: + - UserAuth: [] + parameters: + - name: event_id + in: path + description: Event ID + required: true + schema: + type: string + - name: image_id + in: path + description: ID of the image that needs to be deleted + required: true + schema: + type: string + responses: + 202: + description: Image is deleted + content: + application/json: + schema: + type: object + properties: + status: + type: integer + description: Operation status code + id: + type: integer + format: int64 + description: Event ID + message: + type: string + description: The description of the operation + 500: + description: Internal error +components: + schemas: + Event: + required: + - title + - startDate + - category + type: object + properties: + id: + type: string + description: the event id + sourceEventId: + type: string + description: The ID of the event in the original event source (e.g., WebTools, EMS, etc.) + recurringFlag: + type: boolean + description: a flag to denote this is recurring event + recurrenceId: + type: integer + description: recurring id + category: + type: string + enum: + - Entertainment + - Academic + - Community + - Career Development + - Recreation + - Athletics + - Other + subcategory: + type: string + dateCreated: + type: string + format: date-time + createdBy: + type: string + sponsor: + type: string + description: For example, Center for Advanced Study + title: + type: string + subTitle: + type: string + titleURL: + type: string + description: Title URL representing the event title. For example, https://cas.illinois.edu/node/190 + longDescription: + type: string + shortDescription: + type: string + startDate: + type: string + format: date-time + endDate: + type: string + format: date-time + targetAudience: + type: array + items: + type: "string" + enum: + - students + - faculty + - staff + - alumni + - parents + - public + imageUrl: + type: string + icalUrl: + type: string + outlookUrl: + type: string + speaker: + type: string + registrationLabel: + type: string + registrationURL: + type: string + cost: + type: string + description: For example, Free and open to the public. + contacts: + type: array + xml: + name: "contact" + wrapped: true + items: + $ref: "#/components/schemas/Contact" + tags: + type: array + xml: + name: tag + wrapped: true + items: + type: string + placeId: + type: string + location: + $ref: "#/components/schemas/Location" + dateModified: + type: string + description: store a timestamp when this event was modified. + format: date-time + submissionStatus: + type: string + description: store the status of this event submission + enum: + - submitted + - published + - rejected + - incomplete + - archived + isSuperEvent: + type: boolean + description: States whether an event is a super event (`true`) or not (`false`). A super event is defined as an event that contains one more sub events. E.g. conference, workshop, exhibition, etc. Each sub event can be a featured sub event and can contain a track that the sub event belongs to. + subEvents: + type: array + description: A list of objects containg some basic details about the sub events that are part of a super event. This property currently applies only to a super event. I.e. this assumes that `isSuperEvent` is set to `true`. + items: + $ref: "#/components/schemas/SubEventDetails" + SubEventDetails: + type: object + properties: + id: + type: string + description: ID of the sub event. A sub event is a regular event, except that it's associated with a another event called a super event. + isFeatured: + type: boolean + description: Inidicates whether a sub event is a featured sub event (`true`) or not (`false`). This property can be used to highlight a sub event. + track: + type: string + description: Stores the track or a category that the sub event belongs to. This property can be used to group one or more sub events that are part of a super event. Here, we are using the term *track* in order to differentiate this from the *category* property that is part of the *Event* object. + Categories: + type: object + properties: + category: + type: string + subcategories: + type: array + items: + $ref: '#/components/schemas/SubCategory' + SubCategory: + type: string + Location: + type: object + properties: + locationId: + type: string + room: + type: string + building: + type: string + address: + type: string + latitude: + type: number + description: Latitude component of location. + longitude: + type: number + description: Longitude component of location. + description: + type: string + description: Description of the building from WebTools, e.g., Krannert Center for the Performing Arts, 500 S Goodwin Ave, Urbana. + floor: + type: integer + Contact: + type: object + properties: + firstName: + type: string + lastName: + type: string + email: + type: string + phone: + type: string + organization: + type: string + xml: + name: "Contact" + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: ROKWIRE-API-KEY + x-apikeyInfoFunc: auth_middleware.verify_apikey + description: Each client version has unique API key (e.g., "c6befa22-50a6-4403-a8fc-378c9719743b"). For API endpoints that do not require user authentication, the ROKWIRE-API-KEY header must contain an API key corresponding to a supported client. + UserAuth: + type: http + scheme: bearer + bearerFormat: JWT # https://openid.net/specs/openid-connect-core-1_0.html [id_token] + x-bearerInfoFunc: auth_middleware.verify_userauth + description: The client must send a valid (i.e., signed, not expired) OpenID Connect id_token in the Authorization header when making requests to API endpoints that require user authentication. diff --git a/loggingservice/Dockerfile b/loggingservice/Dockerfile index ecb2171e..349225c2 100644 --- a/loggingservice/Dockerfile +++ b/loggingservice/Dockerfile @@ -20,7 +20,7 @@ RUN apk --update add python py-pip openssl ca-certificates py-openssl && \ WORKDIR /usr/src/app/loggingservice/api -COPY rokwire.yaml . +COPY loggingservice/logging.yaml . #ENV LOGGING_MONGO_URL="" ENV LOGGING_URL_PREFIX="" diff --git a/loggingservice/README.md b/loggingservice/README.md index 5d36424a..2e9d9f13 100644 --- a/loggingservice/README.md +++ b/loggingservice/README.md @@ -36,7 +36,7 @@ export FLASK_ENV=development python logging_rest_service.py ``` and the Logging Building Block should be running at localhost at port 5000 (http://localhost:5000/logs). -The detailed API information is in rokwire.yaml in the OpenAPI Spec 3.0 format. +The detailed API information is in logging.yaml in the OpenAPI Spec 3.0 format. ## Docker Instructions ``` cd rokwire-building-blocks-api diff --git a/loggingservice/api/controllers/config.py b/loggingservice/api/controllers/config.py index 0bbcb84f..0679c64a 100644 --- a/loggingservice/api/controllers/config.py +++ b/loggingservice/api/controllers/config.py @@ -25,7 +25,7 @@ LOGGING_URL_PREFIX = os.getenv('LOGGING_URL_PREFIX', '') FLASK_APP = os.getenv('FLASK_APP', 'logging_rest_service') FLASK_ENV = os.getenv('FLASK_ENV', 'production') -API_LOC = os.getenv('API_LOC', '../../') +API_LOC = os.getenv('API_LOC', '../') PRINT_LOG = bool(os.getenv('PRINT_LOG', 'True') == 'True') DEBUG = bool(os.getenv('DEBUG', 'False') == 'True') diff --git a/loggingservice/api/logging_rest_service.py b/loggingservice/api/logging_rest_service.py index 108cd038..716ff7fd 100644 --- a/loggingservice/api/logging_rest_service.py +++ b/loggingservice/api/logging_rest_service.py @@ -33,7 +33,7 @@ logging.basicConfig(datefmt='%Y-%m-%dT%H:%M:%S', format=log_format, level=logging.INFO) app = connexion.FlaskApp(__name__, debug=debug, specification_dir=cfg.API_LOC) -app.add_api('rokwire.yaml', base_path=cfg.LOGGING_URL_PREFIX, arguments={'title': 'Rokwire'}, resolver=RokwireResolver('controllers'), +app.add_api('logging.yaml', base_path=cfg.LOGGING_URL_PREFIX, arguments={'title': 'Rokwire'}, resolver=RokwireResolver('controllers'), resolver_error=501) if __name__ == '__main__': diff --git a/loggingservice/logging.yaml b/loggingservice/logging.yaml new file mode 100755 index 00000000..36d72cc7 --- /dev/null +++ b/loggingservice/logging.yaml @@ -0,0 +1,145 @@ +openapi: 3.0.0 +info: + title: Rokwire Logging Building Block API + description: Logging Building Block API Documentation + version: 1.5.0 +servers: +- url: https://api.rokwire.illinois.edu + description: Production server +- url: https://api-test.rokwire.illinois.edu + description: Test server +- url: https://api-dev.rokwire.illinois.edu + description: Development server +tags: +- name: Logs + description: API endpoints for managing logs +paths: + /logs: + post: + tags: + - Logs + summary: Create log entries + description: | + Create log entries from the app. + + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + requestBody: + description: A JSON array of one or more log entries. The schema of the request body is only provided as a reference and by default all of its properties are optional. + required: true + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Logs" + example: + - timestamp: "2019-10-05T16:16:50Z" + uuid: "e696663c-06fa-4f23-9427-4376849acb73" + os: ios + osVersion: "12.4" + appVersion: "0.9.5" + device: Samsung Galaxy s10 + deviceSettings: {} + userAction: + type: view + name: homePanel + mainFeature: Home + subFeature: Explore + - timestamp: "2019-10-05T16:16:51Z" + uuid: "e696663c-06fa-4f23-9427-4376849acb73" + os: ios + osVersion: "12.4" + appVersion: "0.9.5" + device: Samsung Galaxy s10 + deviceSettings: {} + userAction: + type: view + name: homePanel + mainFeature: Home + subFeature: Explore + customAttribute1: Double click + responses: + 200: + description: OK + 400: + description: Bad request + 401: + description: Unauthorized + 500: + description: Internal error +components: + schemas: + Logs: + type: object + properties: + timestamp: + type: string + format: date-time + description: Timestamp of the log event as defined by RFC 3339 in the format YYYY-MM-DDThh:mm:ssZ + uuid: + type: string + format: uuid + description: UUID of the app user. + os: + type: string + description: Name of operating system on the device running the app. + osVersion: + type: string + description: Version of operating system on the device running the app. + appVersion: + type: string + description: App version. + device: + type: string + description: Name of device running the app. + deviceSettings: + type: object + description: Object containing relevant device settings. + userAction: + $ref: '#/components/schemas/UserAction' + UserAction: + type: object + description: Object containing details of user action. + properties: + type: + type: string + description: Type of user action. Examples can be 'click', 'view', etc. + name: + type: string + description: Name of user action. This can include the page user is viewing or the UI widget the user is clicking on when generating a log entry. This property can depend on the user action type. + mainFeature: + type: string + description: Name of the main feature that the user is using when generating a log entry. + subFeature: + type: string + description: Name of the sub-feature that the user is using when generating a log entry. + customAttribute1: + type: string + description: Custom attribute provided for future use. + customAttribute2: + type: string + description: Custom attribute provided for future use. + customAttribute3: + type: string + description: Custom attribute provided for future use. + customAttribute4: + type: string + description: Custom attribute provided for future use. + customAttribute5: + type: string + description: Custom attribute provided for future use. + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: ROKWIRE-API-KEY + x-apikeyInfoFunc: auth_middleware.verify_apikey + description: Each client version has unique API key (e.g., "c6befa22-50a6-4403-a8fc-378c9719743b"). For API endpoints that do not require user authentication, the ROKWIRE-API-KEY header must contain an API key corresponding to a supported client. + UserAuth: + type: http + scheme: bearer + bearerFormat: JWT # https://openid.net/specs/openid-connect-core-1_0.html [id_token] + x-bearerInfoFunc: auth_middleware.verify_userauth + description: The client must send a valid (i.e., signed, not expired) OpenID Connect id_token in the Authorization header when making requests to API endpoints that require user authentication. diff --git a/profileservice/Dockerfile b/profileservice/Dockerfile index eeeb0254..24c7de71 100644 --- a/profileservice/Dockerfile +++ b/profileservice/Dockerfile @@ -20,7 +20,7 @@ RUN apk --update add python py-pip openssl ca-certificates py-openssl && \ WORKDIR /usr/src/app/profileservice/api -COPY rokwire.yaml . +COPY profileservice/profile.yaml . ENV PROFILE_REST_STORAGE="/usr/src/app/rest" \ MONGO_PROFILE_URL="" \ diff --git a/profileservice/README.md b/profileservice/README.md index 0c33cc00..db4f60e8 100644 --- a/profileservice/README.md +++ b/profileservice/README.md @@ -71,7 +71,7 @@ python api/profile_rest_service.py` If you want to use gunicorn, cd into api folder then, use ` gunicorn profile_rest_service:app -c gunicorn.config.py` instead of `python api/profile_rest_service.py` The profile building block should be running at http://localhost:5000 -The detailed API information is in rokwire.yaml in the OpenAPI Spec 3.0 format. +The detailed API information is in profile.yaml in the OpenAPI Spec 3.0 format. ### Docker Instructions ``` diff --git a/profileservice/api/controllers/configs.py b/profileservice/api/controllers/configs.py index 4f7da95e..d75580fc 100644 --- a/profileservice/api/controllers/configs.py +++ b/profileservice/api/controllers/configs.py @@ -25,7 +25,7 @@ MONGO_PII_URL = os.getenv('MONGO_PII_URL', 'localhost:27017') FLASK_APP = os.getenv('FLASK_APP', 'profile_rest_service') FLASK_ENV = os.getenv('FLASK_ENV', 'production') -API_LOC = os.getenv('API_LOC', '../../') +API_LOC = os.getenv('API_LOC', '../') PROFILE_URL_PREFIX = os.getenv('PROFILE_URL_PREFIX', '') DEBUG = bool(os.getenv('DEBUG', 'False') == 'True') diff --git a/profileservice/api/profile_rest_service.py b/profileservice/api/profile_rest_service.py index ed10a7bf..890030a8 100644 --- a/profileservice/api/profile_rest_service.py +++ b/profileservice/api/profile_rest_service.py @@ -33,7 +33,7 @@ logging.basicConfig(datefmt='%Y-%m-%dT%H:%M:%S', format=log_format, level=logging.INFO) app = connexion.FlaskApp(__name__, debug=debug, specification_dir=cfg.API_LOC) -app.add_api('rokwire.yaml', base_path=cfg.PROFILE_URL_PREFIX, arguments={'title': 'Rokwire'}, resolver=RokwireResolver('controllers'), +app.add_api('profile.yaml', base_path=cfg.PROFILE_URL_PREFIX, arguments={'title': 'Rokwire'}, resolver=RokwireResolver('controllers'), resolver_error=501) if __name__ == '__main__': diff --git a/profileservice/profile.yaml b/profileservice/profile.yaml new file mode 100755 index 00000000..d0fdc945 --- /dev/null +++ b/profileservice/profile.yaml @@ -0,0 +1,626 @@ +openapi: 3.0.0 +info: + title: Rokwire Profile Building Block API + description: Profile Building Block API Documentation + version: 1.5.0 +servers: +- url: https://api.rokwire.illinois.edu + description: Production server +- url: https://api-test.rokwire.illinois.edu + description: Test server +- url: https://api-dev.rokwire.illinois.edu + description: Development server +tags: +- name: Profile + description: API endpoints for managing non-PII user profile. +- name: PII + description: API endpoints for managing PII user profile. +paths: + /profiles: + post: + tags: + - Profile + summary: Create profile + description: | + Create non-PII profile with profile id. + + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + requestBody: + description: Created profile object + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Non-pii' + required: false + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Non-pii' + 400: + description: Bad request + 401: + description: Unauthorized + 500: + description: Internal error + /profiles/device-data: + get: + tags: + - Profile + summary: Get device token data from Non-PII profile + description: | + By passing in the appropriate options, you can search for Profile matching your criteria in the system + Auth: Requires a valid API Key for access. + security: + - ApiKeyAuth: [] + parameters: + - name: favorites.eventId + in: query + description: The parameter for searching Non PII device data based on user's favorite Event's ID + required: false + style: form + explode: true + schema: + type: string + responses: + 200: + description: Ok + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/NonPIIDeviceData' + 400: + description: Bad request + 401: + description: Unauthorized + 500: + description: Internal error + /profiles/{uuid}: + get: + tags: + - Profile + summary: Find profile by ID + description: | + Returns a single profile + + Auth: Requires a valid API Key and profile uuid for access. + security: + - ApiKeyAuth: [] + parameters: + - name: uuid + in: path + description: ID of profile to return + required: true + style: simple + explode: false + schema: + type: string + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Non-pii' + application/xml: + schema: + $ref: '#/components/schemas/Non-pii' + 400: + description: Invalid ID supplied + 401: + description: Unauthorized + 404: + description: Profile not found + 500: + description: Internal error + put: + tags: + - Profile + summary: Updates a profile with form data + description: | + Auth: Requires a valid API Key and profile uuid for access. + security: + - ApiKeyAuth: [] + parameters: + - name: uuid + in: path + description: ID of profile that needs to be updated + required: true + style: simple + explode: false + schema: + type: string + requestBody: + description: update profile object + content: + application/json: + schema: + $ref: '#/components/schemas/Non-pii' + required: true + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Non-pii' + application/xml: + schema: + $ref: '#/components/schemas/Non-pii' + 400: + description: Invalid ID supplied + 401: + description: Unauthorized + 405: + description: Invalid input + 500: + description: Internal error + delete: + tags: + - Profile + summary: Deletes a profile + description: | + Auth: Requires a valid API Key and profile uuid for access. + security: + - ApiKeyAuth: [] + parameters: + - name: uuid + in: path + description: Profile id to delete + required: true + style: simple + explode: false + schema: + type: string + responses: + 202: + description: Profile is deleted + 400: + description: Invalid ID supplied + 401: + description: Unauthorized + 404: + description: Profile not found + 500: + description: Internal error + /profiles/pii: + post: + tags: + - PII + summary: Create PII entry + description: | + This creates a new PII entry. + User's UUID must be provided as a string or as a list of string. + + Auth: Requires a valid id_token for access. The UIN / phone number in the PII entry is populated from the id_token contents. Remaining data is obtained from the request body. + security: + - UserAuth: [] + requestBody: + description: PII profile data + content: + application/json: + schema: + $ref: '#/components/schemas/Pii' + examples: + UUID list: + value: + uuid: ["3fa85f64-5717-4562-b3fc-2c963f66afa6"] + UUID string: + value: + uuid: "3fa85f64-5717-4562-b3fc-2c963f66afa6" + UUID string with more request body: + value: + uuid: "3fa85f64-5717-4562-b3fc-2c963f66afa6" + address: 79137 Kristina Lights + birthYear: 1999 + country: USA + email: Janie.Daniel33@hotmail.com + firstname: Ben + healthcareProviderIDs: + - 5ca68256-6a9a-4cfe-9246-3ddd5ee9580a + - aa6897cf-2c31-41a1-be2c-52ebaf4d50f5 + - aeb55bab-ebe3-4066-9f1a-323502a58c12 + homeCounty: Josianeburgh + lastname: Barrows + middlename: Levin + phone: +17972114377 + photoImageBase64: null + state: Illinois + testResultsConsent: + consentProvided: true + workCounty: Donnieberg + zipCode: "61801" + responses: + 200: + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/Pii' + examples: + UUID string with more request body: + value: + address: 79137 Kristina Lights + birthYear: 1999 + country: USA + creationDate: "2020-05-05T04:44:45.943Z" + email: Janie.Daniel33@hotmail.com + firstname: Ben + healthcareProviderIDs: + - 5ca68256-6a9a-4cfe-9246-3ddd5ee9580a + - aa6897cf-2c31-41a1-be2c-52ebaf4d50f5 + - aeb55bab-ebe3-4066-9f1a-323502a58c12 + homeCounty: Josianeburgh + imageUrl: null + lastModifiedDate: "2020-05-05T04:44:45.943Z" + lastname: Barrows + middlename: Levin + netid: null + phone: +17972114377 + photoImageBase64: null + pid: c84bfd99-e40d-43d5-854f-33859de593d5 + state: Illinois + testResultsConsent: + consentProvided: true + dateModified: "2020-05-05T04:44:45.943Z" + uin: "100000001" + username: null + uuid: + - 3fa85f64-5717-4562-b3fc-2c963f66afa6 + workCounty: Donnieberg + zipCode: "61801" + 400: + description: Bad request + 401: + description: Unauthorized + 500: + description: Internal error + /profiles/pii/{pid}: + get: + tags: + - PII + summary: Get PII by PID + description: | + Returns a single PII entry. + + Auth: Requires a valid id_token and PID for access. The contents of the id_token (phone number, uin) must match the PII entry contents. + security: + - UserAuth: [] + parameters: + - name: pid + in: path + description: ID of PII to return + required: true + style: simple + explode: false + schema: + type: string + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Pii' + application/xml: + schema: + $ref: '#/components/schemas/Pii' + 400: + description: Invalid ID supplied + 401: + description: Unauthorized + 404: + description: Profile not found + 500: + description: Internal error + put: + tags: + - PII + summary: Updates a PII with form data + description: | + Auth: Requires a valid id_token and PID For access. The contents of the id_token (phone number, uin) must match the old and new PII entry contents (i.e., phone number and uin can't be changed). + security: + - UserAuth: [] + parameters: + - name: pid + in: path + description: ID of PII that needs to be updated + required: true + style: simple + explode: false + schema: + type: string + requestBody: + description: update profile object + content: + application/json: + schema: + $ref: '#/components/schemas/Pii' + example: + address: 2000 Kristina Lights + birthYear: 1999 + country: USA + creationDate: "2020-05-05T04:44:45.943Z" + email: Alice.Bob@hotmail.com + firstname: Ben + healthcareProviderIDs: + - 5ca68256-6a9a-4cfe-9246-3ddd5ee9580a + - aa6897cf-2c31-41a1-be2c-52ebaf4d50f5 + homeCounty: Josianeburgh + imageUrl: null + lastModifiedDate: "2020-05-05T04:44:45.943Z" + lastname: Barrows + middlename: Levin + netid: null + phone: "+17972114377" + photoImageBase64: null + pid: c84bfd99-e40d-43d5-854f-33859de593d5 + state: Illinois + testResultsConsent: + consentProvided: false + dateModified: "2020-05-05T04:44:45.943Z" + uin: "100000001" + username: null + uuid: + - 3fa85f64-5717-4562-b3fc-2c963f66afa6 + workCounty: Donnieberg + zipCode: "61821" + required: true + responses: + 200: + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Pii' + example: + address: 2000 Kristina Lights + birthYear: 1999 + country: USA + creationDate: 2020-05-05T04:44:45.943Z + email: Alice.Bob@hotmail.com + firstname: Ben + healthcareProviderIDs: + - 5ca68256-6a9a-4cfe-9246-3ddd5ee9580a + - aa6897cf-2c31-41a1-be2c-52ebaf4d50f5 + homeCounty: Josianeburgh + imageUrl: null + lastModifiedDate: "2020-05-05T04:44:45.943Z" + lastname: Barrows + middlename: Levin + netid: null + phone: "+17972114377" + photoImageBase64: null + pid: c84bfd99-e40d-43d5-854f-33859de593d5 + state: Illinois + testResultsConsent: + consentProvided: false + dateModified: "2020-05-05T04:44:45.943Z" + uin: "100000001" + username: null + uuid: + - 3fa85f64-5717-4562-b3fc-2c963f66afa6 + workCounty: Donnieberg + zipCode: "61821" + application/xml: + schema: + $ref: '#/components/schemas/Pii' + 400: + description: Invalid ID supplied + 401: + description: Unauthorized + 405: + description: Invalid input + 500: + description: Internal error + delete: + tags: + - PII + summary: Deletes a PII + description: | + Auth: Requires a valid id_token and PID For access. The contents of the id_token (phone number, uin) must match the contents of the PII entry to be deleted. + security: + - UserAuth: [] + parameters: + - name: pid + in: path + description: Pii id to delete + required: true + style: simple + explode: false + schema: + type: string + responses: + 202: + description: Profile is deleted + 400: + description: Invalid ID supplied + 401: + description: Unauthorized + 404: + description: Profile not found + 500: + description: Internal error +components: + schemas: + Non-pii: + type: object + nullable: true + properties: + uuid: + type: string + format: uuid + over13: + nullable: true + type: boolean + interests: + type: array + items: + properties: + category: + type: string + subcategories: + type: array + items: + type: string + positiveInterestTags: + nullable: true + type: array + items: + type: string + negativeInterestTags: + nullable: true + type: array + items: + type: string + favorites: + nullable: true + type: object + items: + properties: + eventIds: + type: array + items: + type: string + placeIds: + type: array + items: + type: string + diningPlaceIds: + type: array + items: + type: string + laundryPlaceIds: + type: array + items: + type: string + athleticEventIds: + type: array + items: + type: string + privacySettings: + nullable: true + type: object + properties: + level: + type: integer + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + dataModified: + type: string + creationDate: + type: string + lastModifiedDate: + type: string + Pii: + type: object + properties: + pid: + type: string + uuid: + oneOf: + - type: string + format: uuid + - type: array + items: + type: string + format: uuid + userName: + nullable: true + type: string + firstname: + nullable: true + type: string + lastname: + nullable: true + type: string + middlename: + nullable: true + type: string + email: + nullable: true + type: string + phone: + nullable: true + type: string + birthYear: + nullable: true + type: integer + format: int8 + address: + nullable: true + type: string + zipCode: + nullable: true + type: string + homeCounty: + nullable: true + type: string + workCounty: + nullable: true + type: string + state: + nullable: true + type: string + country: + nullable: true + type: string + healthcareProviderIDs: + nullable: true + type: array + items: + type: string + testResultsConsent: + type: object + nullable: true + properties: + consentProvided : + type: boolean + dateModified: + type: string + photoImageBase64: + nullable: true + type: string + format: byte + imageUrl: + nullable: true + type: string + creationDate: + description: creation date will not be modified once it get set. + type: string + lastModifiedDate: + description: last modified date will be updated in the endpoint not from the input request. + type: string + NonPIIDeviceData: + type: object + nullable: true + properties: + deviceToken: + type: string + uuid: + type: string + format: uuid + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: ROKWIRE-API-KEY + x-apikeyInfoFunc: auth_middleware.verify_apikey + description: Each client version has unique API key (e.g., "c6befa22-50a6-4403-a8fc-378c9719743b"). For API endpoints that do not require user authentication, the ROKWIRE-API-KEY header must contain an API key corresponding to a supported client. + UserAuth: + type: http + scheme: bearer + bearerFormat: JWT # https://openid.net/specs/openid-connect-core-1_0.html [id_token] + x-bearerInfoFunc: auth_middleware.verify_userauth + description: The client must send a valid (i.e., signed, not expired) OpenID Connect id_token in the Authorization header when making requests to API endpoints that require user authentication. From 8b740402d3dbf2b579fc564644679b680568368b Mon Sep 17 00:00:00 2001 From: Wenjie Date: Thu, 16 Jul 2020 16:40:04 -0500 Subject: [PATCH 04/29] Task/497 add standard licence header to authentication bb (#502) * Add license header * Update CHANGELOG.md Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 1 + authservice/__init__.py | 13 +++++++++++ authservice/auth_rest_service.py | 33 +++++++++++++++++++--------- authservice/dev/__init__.py | 13 +++++++++++ authservice/dev/research/__init__.py | 13 +++++++++++ authservice/dev/research/research.py | 14 +++++++++++- authservice/gunicorn.config.py | 14 ++++++++++++ 7 files changed, 90 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cb75b6c..3200b697 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added - Add Standard License Header for Events Building Block. [#480](https://github.com/rokwire/rokwire-building-blocks-api/issues/480) +- Add Standard License Header for Authentication Building Block [#497](https://github.com/rokwire/rokwire-building-blocks-api/issues/497) ### Changed - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) diff --git a/authservice/__init__.py b/authservice/__init__.py index e69de29b..6cab36e6 100644 --- a/authservice/__init__.py +++ b/authservice/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/authservice/auth_rest_service.py b/authservice/auth_rest_service.py index 73ec8877..43550c07 100644 --- a/authservice/auth_rest_service.py +++ b/authservice/auth_rest_service.py @@ -1,18 +1,32 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging import os -import jwt -import schema import pprint import socket -import logging -import requests -import connexion -import auth_middleware - from datetime import datetime -from flask import request, abort -from dateutil.relativedelta import relativedelta from time import gmtime + +import auth_middleware +import connexion +import jwt +import requests +import schema +from dateutil.relativedelta import relativedelta from dotenv import load_dotenv +from flask import request, abort logging.Formatter.converter = gmtime logging.basicConfig(level=logging.INFO, datefmt='%Y-%m-%dT%H:%M:%S', @@ -134,7 +148,6 @@ def ping(): resolver_error=501, ) - # @app.app.before_request # def before_request(): # user_agent = request.headers.get('User-Agent') diff --git a/authservice/dev/__init__.py b/authservice/dev/__init__.py index e69de29b..6cab36e6 100644 --- a/authservice/dev/__init__.py +++ b/authservice/dev/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/authservice/dev/research/__init__.py b/authservice/dev/research/__init__.py index e69de29b..6cab36e6 100644 --- a/authservice/dev/research/__init__.py +++ b/authservice/dev/research/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/authservice/dev/research/research.py b/authservice/dev/research/research.py index 72ffefe9..7090e6e5 100644 --- a/authservice/dev/research/research.py +++ b/authservice/dev/research/research.py @@ -1,4 +1,16 @@ - +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. def decodeit(id_token): import jwt diff --git a/authservice/gunicorn.config.py b/authservice/gunicorn.config.py index 9e161981..63f792be 100644 --- a/authservice/gunicorn.config.py +++ b/authservice/gunicorn.config.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """Gunicorn configuration.""" bind = '0.0.0.0:5000' From 44aa7e504617c0345e5ea401da403157603202c6 Mon Sep 17 00:00:00 2001 From: ywkim312 Date: Thu, 16 Jul 2020 16:43:06 -0500 Subject: [PATCH 05/29] added license header to auth library (#504) * added license header to auth library * added license header to lib folder Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 1 + auth-middleware-test-svc/flaskapp.py | 14 ++++++++++++++ auth-middleware-test-svc/gunicorn.config.py | 14 ++++++++++++++ lib/auth-middleware/auth_middleware/__init__.py | 14 ++++++++++++++ lib/auth-middleware/setup.py | 14 ++++++++++++++ 5 files changed, 57 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3200b697..230a6c46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add Standard License Header for Events Building Block. [#480](https://github.com/rokwire/rokwire-building-blocks-api/issues/480) - Add Standard License Header for Authentication Building Block [#497](https://github.com/rokwire/rokwire-building-blocks-api/issues/497) +- Add Standard License Header for Authentication Library. [#498](https://github.com/rokwire/rokwire-building-blocks-api/issues/498) ### Changed - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) diff --git a/auth-middleware-test-svc/flaskapp.py b/auth-middleware-test-svc/flaskapp.py index ec8a51f4..62c1372a 100644 --- a/auth-middleware-test-svc/flaskapp.py +++ b/auth-middleware-test-svc/flaskapp.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import flask import auth_middleware diff --git a/auth-middleware-test-svc/gunicorn.config.py b/auth-middleware-test-svc/gunicorn.config.py index 418766c2..fef2dfc9 100644 --- a/auth-middleware-test-svc/gunicorn.config.py +++ b/auth-middleware-test-svc/gunicorn.config.py @@ -1,5 +1,19 @@ """Gunicorn configuration.""" +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + bind = '0.0.0.0:5000' workers = 4 diff --git a/lib/auth-middleware/auth_middleware/__init__.py b/lib/auth-middleware/auth_middleware/__init__.py index ee75fc01..4c457e37 100644 --- a/lib/auth-middleware/auth_middleware/__init__.py +++ b/lib/auth-middleware/auth_middleware/__init__.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import base64 import json import logging diff --git a/lib/auth-middleware/setup.py b/lib/auth-middleware/setup.py index 81c06ece..a6ad6b5e 100644 --- a/lib/auth-middleware/setup.py +++ b/lib/auth-middleware/setup.py @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from setuptools import setup setup( From f4a9fffde240268f67f040582ff62538a3cfd694 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Fri, 17 Jul 2020 09:25:09 -0500 Subject: [PATCH 06/29] Update Swagger-UI version. (#505) --- CHANGELOG.md | 1 + Dockerfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 230a6c46..5ebb182d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) +- Update Swagger-UI version. [#500](https://github.com/rokwire/rokwire-building-blocks-api/issues/500) ## [1.6.0] - 2020-07-14 - Add Health Building Block APIs documentation. [#468](https://github.com/rokwire/rokwire-building-blocks-api/issues/468) diff --git a/Dockerfile b/Dockerfile index f13346e4..8c305f88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM swaggerapi/swagger-ui:v3.23.5 +FROM swaggerapi/swagger-ui:v3.28.0 COPY rokwire.yaml /usr/share/nginx/html/app/ From 9416bea0d0df3843dd4bdaa5a58d2ef6fb66169e Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Fri, 17 Jul 2020 13:07:28 -0500 Subject: [PATCH 07/29] Task/486 update api doc docker file to use multiple open api specifications (#503) * Use separate OpenAPI specification file for Profile Building Block. * Use separate OpenAPI specification file for Logging Building Block. * Use separate OpenAPI specification file for Events Building Block. * Use separate OpenAPI specification file for Auth Building Block. Other minor updates. * Use separate OpenAPI specification file for App Config Building Block. * Update CHANGELOG. * Update Docker file. * Update README. * Remove rokwire.yaml. * Remove scripts in the deployement folder as it's not being used at this time. * Update CHANGELOG. --- CHANGELOG.md | 7 + Dockerfile | 8 +- README.md | 54 +- deployment/start_app_config_container.sh | 32 - deployment/start_rokwire_apidoc_container.sh | 37 - deployment/stop_app_config_container.sh | 24 - deployment/stop_rokwire_apidoc_container.sh | 24 - rokwire.yaml | 1926 ------------------ 8 files changed, 18 insertions(+), 2094 deletions(-) delete mode 100755 deployment/start_app_config_container.sh delete mode 100755 deployment/start_rokwire_apidoc_container.sh delete mode 100755 deployment/stop_app_config_container.sh delete mode 100755 deployment/stop_rokwire_apidoc_container.sh delete mode 100755 rokwire.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ebb182d..b207d218 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) - Update Swagger-UI version. [#500](https://github.com/rokwire/rokwire-building-blocks-api/issues/500) +### Changed +- OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) +- Rokwire API Doc Dockerfile to integrate multiple OpenAPI specifications file. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) + +### Removed +- rokwire.yaml file and deployment scripts that were not getting used. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) + ## [1.6.0] - 2020-07-14 - Add Health Building Block APIs documentation. [#468](https://github.com/rokwire/rokwire-building-blocks-api/issues/468) - Code of Conduct. [#487](https://github.com/rokwire/rokwire-building-blocks-api/issues/487) diff --git a/Dockerfile b/Dockerfile index 8c305f88..45a4cbc7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,12 @@ FROM swaggerapi/swagger-ui:v3.28.0 -COPY rokwire.yaml /usr/share/nginx/html/app/ +COPY appconfigservice/appconfig.yaml /usr/share/nginx/html/app/ +COPY authservice/auth.yaml /usr/share/nginx/html/app/ +COPY eventservice/events.yaml /usr/share/nginx/html/app/ +COPY profileservice/profile.yaml /usr/share/nginx/html/app/ +COPY loggingservice/logging.yaml /usr/share/nginx/html/app/ -ENV URLS "[{ url: 'app/rokwire.yaml', name: 'rokwire' } , { url: 'https://api-dev.rokwire.illinois.edu/health/doc', name: 'Health Building Block' } ]" +ENV URLS "[{url: 'app/appconfig.yaml', name: 'App Config Building Block'}, {url: 'app/auth.yaml', name: 'Authentication Building Block'}, {url: 'app/events.yaml', name: 'Events Building Block'}, {url: 'app/profile.yaml', name: 'Profile Building Block'}, {url: 'app/logging.yaml', name: 'Logging Building Block'}, {url: 'https://api-dev.rokwire.illinois.edu/health/doc', name: 'Health Building Block'} ]" VOLUME /usr/share/nginx/html/app/ diff --git a/README.md b/README.md index 838d9ca9..c1de7912 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,14 @@ -# Rokwire Building Blocks API +# Rokwire Platform Building Blocks API Documentation API definitions of the Rokwire Platform building blocks -## How to view API design doc +## Setup and Run -There are several ways to view API design and document using Swagger: - -- Go to [Swagger UI demo page](https://petstore.swagger.io/) and paste [Rokwire API YAML file URL](https://raw.githubusercontent.com/rokwire/rokwire-building-blocks-api/develop/rokwire.yaml) there. - -- Sign up a free account at [SwaggerHub](https://swagger.io/tools/swaggerhub/) and create new API by importing your copy of rokwire.yaml file. - -- Get swagger docker image, for example - - docker pull swaggerapi/swagger-ui - - Run docker image locally by executing command like - - docker run -p 80:8080 -e SWAGGER_JSON=/foo/rokwire.yaml -v /rokwire_yaml_local_dir/:/foo -e BASE_URL=/docs swaggerapi/swagger-ui - - Then access the API doc at http://localhost/docs. - -- Create Rokwire Platform API Docker image using instructions in section `Docker / AWS ECR` and run: +- Create the Rokwire Platform API Doc Docker image and run the Docker container: + docker build -t rokwire/api-doc . docker run -p 80:8080 rokwire/api-doc - Then access the API doc at http://localhost/docs. + Now you can view the API documentation at http://localhost/docs/ ## Docker / AWS ECR @@ -34,32 +19,3 @@ docker build -t rokwire/api-doc . docker tag rokwire/api-doc:latest 779619664536.dkr.ecr.us-east-2.amazonaws.com/rokwire/api-doc:latest docker push 779619664536.dkr.ecr.us-east-2.amazonaws.com/rokwire/api-doc:latest ``` - -## AWS EC2 Deployment - -- Deploy api doc to AWS instance (created with Ubuntu Server 18.04 LTS image) - - ``` - cd /home/ubuntu - git clone https://github.com/rokwire/rokwire-building-blocks-api.git - - ``` - - Start docker container on AWS instance - - Make sure one of the security groups that the instance associated with, includes inbound rule accepting http requests from port 80 and 8080. - - ``` - cd /home/ubuntu/rokwire-building-blocks/deployment - sh start_rokwire_apidoc_container.sh - - ``` - Stop and remove docker container on AWS instance - - ``` - cd /home/ubuntu/rokwire-building-blocks/deployment - sh stop_rokwire_apidoc_container.sh - - ``` - - diff --git a/deployment/start_app_config_container.sh b/deployment/start_app_config_container.sh deleted file mode 100755 index 875ae8d3..00000000 --- a/deployment/start_app_config_container.sh +++ /dev/null @@ -1,32 +0,0 @@ -# Start Swagger docker container to host Rokwire API documentation -sudo apt-get update -if [ -x "$(command -v docker)" ]; then - echo "Update Docker" - sudo apt-get --only-upgrade install docker.io -else - echo "Install docker" - #install Docker from Ubuntu repository - sudo apt-get install docker.io -fi - -name="app_config" - -appconfigImage="app_config:latest" - -matchingImage=$(sudo docker images -q $appconfigImage -q | xargs) -if [ -z $matchingImage ]; then - echo "Building app_config docker" - docker build -t=app_config:latest ../appconfigservice -fi - -matchingStarted=$(sudo docker ps --filter="name=$name" -q | xargs) -if [ -z $matchingStarted ]; then - matchingContainer=$(sudo docker container ls -a --filter="name=$name" -q | xargs) - if [ ! -z $matchingContainer ]; then - echo "Remove app_config docker container" - sudo docker rm $matchingContainer - fi - echo "Start app_config docker container" - sudo docker run --network host -d --name app_config -it app_config:latest& -fi - \ No newline at end of file diff --git a/deployment/start_rokwire_apidoc_container.sh b/deployment/start_rokwire_apidoc_container.sh deleted file mode 100755 index a3e3110c..00000000 --- a/deployment/start_rokwire_apidoc_container.sh +++ /dev/null @@ -1,37 +0,0 @@ -# Start Swagger docker container to host Rokwire API documentation -sudo apt-get update -if [ -x "$(command -v docker)" ]; then - echo "Update Docker" - sudo apt-get --only-upgrade install docker.io -else - echo "Install docker" - #install Docker from Ubuntu repository - sudo apt-get install docker.io -fi - -name="rokwire-api-doc" - -swaggerImage="swaggerapi/swagger-ui:latest" - -matchingImage=$(sudo docker images -q $swaggerImage -q | xargs) -if [ -z $matchingImage ]; then - echo "Pull Swagger docker image" - sudo docker pull swaggerapi/swagger-ui -fi - -matchingStarted=$(sudo docker ps --filter="name=$name" -q | xargs) -if [ -z $matchingStarted ]; then - matchingContainer=$(sudo docker container ls -a --filter="name=$name" -q | xargs) - if [ ! -z $matchingContainer ]; then - echo "Remove Swagger docker container" - sudo docker rm $matchingContainer - fi - echo "Start Swagger docker container" - sudo docker run \ - --name=$name \ - -p 80:8080 \ - -e BASE_URL=/docs/ \ - -e SWAGGER_JSON=/rokwire-api-doc/rokwire.yaml \ - -v /home/ubuntu/rokwire-building-blocks-api:/rokwire-api-doc \ - swaggerapi/swagger-ui& -fi diff --git a/deployment/stop_app_config_container.sh b/deployment/stop_app_config_container.sh deleted file mode 100755 index 9aaa298a..00000000 --- a/deployment/stop_app_config_container.sh +++ /dev/null @@ -1,24 +0,0 @@ -# Stop and remove app_config docker container that hosts Rokwire App Config API -sudo apt-get update -if [ -x "$(command -v docker)" ]; then - echo "Update Docker" - sudo apt-get --only-upgrade install docker.io -else - echo "Install Docker" - #install docker from Ubuntu repository - sudo apt-get install docker.io -fi - -name="app_config" - -matchingStarted=$(sudo docker ps --filter="name=$name" -q | xargs) -if [ ! -z $matchingStarted ]; then - echo "Stop app_config docker container" - sudo docker stop $matchingStarted -fi - -matching=$(sudo docker container ls -a --filter="name=$name" -q | xargs) -if [ ! -z $matching ]; then - echo "Remove app_config docker container" - sudo docker rm $matching -fi \ No newline at end of file diff --git a/deployment/stop_rokwire_apidoc_container.sh b/deployment/stop_rokwire_apidoc_container.sh deleted file mode 100755 index 8affa365..00000000 --- a/deployment/stop_rokwire_apidoc_container.sh +++ /dev/null @@ -1,24 +0,0 @@ -# Stop and remove Swagger docker container that hosts Rokwire API documentation -sudo apt-get update -if [ -x "$(command -v docker)" ]; then - echo "Update Docker" - sudo apt-get --only-upgrade install docker.io -else - echo "Install Docker" - #install docker from Ubuntu repository - sudo apt-get install docker.io -fi - -name="rokwire-api-doc" - -matchingStarted=$(sudo docker ps --filter="name=$name" -q | xargs) -if [ ! -z $matchingStarted ]; then - echo "Stop Swagger docker container" - sudo docker stop $matchingStarted -fi - -matching=$(sudo docker container ls -a --filter="name=$name" -q | xargs) -if [ ! -z $matching ]; then - echo "Remove Swagger docker container" - sudo docker rm $matching -fi \ No newline at end of file diff --git a/rokwire.yaml b/rokwire.yaml deleted file mode 100755 index 85318b39..00000000 --- a/rokwire.yaml +++ /dev/null @@ -1,1926 +0,0 @@ -openapi: 3.0.0 -info: - title: Rokwire Platform API - description: Rokwire Platform API Documentation - version: 1.6.0 -servers: -- url: https://api.rokwire.illinois.edu - description: Production server -- url: https://api-test.rokwire.illinois.edu - description: Test server -- url: https://api-dev.rokwire.illinois.edu - description: Development server -tags: -- name: Profile - description: API endpoints for managing non-PII user profile. -- name: PII - description: API endpoints for managing PII user profile. -- name: Events - description: API endpoints for managing events. -- name: App Configuration - description: API endpoints for managing mobile app configuration -- name: Logs - description: API endpoints for managing logs -- name: Authentication - description: API endpoints for managing user phone number verification. -paths: - /profiles: - post: - tags: - - Profile - summary: Create profile - description: | - Create non-PII profile with profile id. - - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - requestBody: - description: Created profile object - content: - application/json: - schema: - oneOf: - - $ref: '#/components/schemas/Non-pii' - required: false - responses: - 200: - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Non-pii' - 400: - description: Bad request - 401: - description: Unauthorized - 500: - description: Internal error - /profiles/device-data: - get: - tags: - - Profile - summary: Get device token data from Non-PII profile - description: | - By passing in the appropriate options, you can search for Profile matching your criteria in the system - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - parameters: - - name: favorites.eventId - in: query - description: The parameter for searching Non PII device data based on user's favorite Event's ID - required: false - style: form - explode: true - schema: - type: string - responses: - 200: - description: Ok - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/NonPIIDeviceData' - 400: - description: Bad request - 401: - description: Unauthorized - 500: - description: Internal error - /profiles/{uuid}: - get: - tags: - - Profile - summary: Find profile by ID - description: | - Returns a single profile - - Auth: Requires a valid API Key and profile uuid for access. - security: - - ApiKeyAuth: [] - parameters: - - name: uuid - in: path - description: ID of profile to return - required: true - style: simple - explode: false - schema: - type: string - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Non-pii' - application/xml: - schema: - $ref: '#/components/schemas/Non-pii' - 400: - description: Invalid ID supplied - 401: - description: Unauthorized - 404: - description: Profile not found - 500: - description: Internal error - put: - tags: - - Profile - summary: Updates a profile with form data - description: | - Auth: Requires a valid API Key and profile uuid for access. - security: - - ApiKeyAuth: [] - parameters: - - name: uuid - in: path - description: ID of profile that needs to be updated - required: true - style: simple - explode: false - schema: - type: string - requestBody: - description: update profile object - content: - application/json: - schema: - $ref: '#/components/schemas/Non-pii' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Non-pii' - application/xml: - schema: - $ref: '#/components/schemas/Non-pii' - 400: - description: Invalid ID supplied - 401: - description: Unauthorized - 405: - description: Invalid input - 500: - description: Internal error - delete: - tags: - - Profile - summary: Deletes a profile - description: | - Auth: Requires a valid API Key and profile uuid for access. - security: - - ApiKeyAuth: [] - parameters: - - name: uuid - in: path - description: Profile id to delete - required: true - style: simple - explode: false - schema: - type: string - responses: - 202: - description: Profile is deleted - 400: - description: Invalid ID supplied - 401: - description: Unauthorized - 404: - description: Profile not found - 500: - description: Internal error - /profiles/pii: - post: - tags: - - PII - summary: Create PII entry - description: | - This creates a new PII entry. - User's UUID must be provided as a string or as a list of string. - - Auth: Requires a valid id_token for access. The UIN / phone number in the PII entry is populated from the id_token contents. Remaining data is obtained from the request body. - security: - - UserAuth: [] - requestBody: - description: PII profile data - content: - application/json: - schema: - $ref: '#/components/schemas/Pii' - examples: - UUID list: - value: - uuid: ["3fa85f64-5717-4562-b3fc-2c963f66afa6"] - UUID string: - value: - uuid: "3fa85f64-5717-4562-b3fc-2c963f66afa6" - UUID string with more request body: - value: - uuid: "3fa85f64-5717-4562-b3fc-2c963f66afa6" - address: 79137 Kristina Lights - birthYear: 1999 - country: USA - email: Janie.Daniel33@hotmail.com - firstname: Ben - healthcareProviderIDs: - - 5ca68256-6a9a-4cfe-9246-3ddd5ee9580a - - aa6897cf-2c31-41a1-be2c-52ebaf4d50f5 - - aeb55bab-ebe3-4066-9f1a-323502a58c12 - homeCounty: Josianeburgh - lastname: Barrows - middlename: Levin - phone: +17972114377 - photoImageBase64: null - state: Illinois - testResultsConsent: - consentProvided: true - workCounty: Donnieberg - zipCode: "61801" - responses: - 200: - description: Ok - content: - application/json: - schema: - $ref: '#/components/schemas/Pii' - examples: - UUID string with more request body: - value: - address: 79137 Kristina Lights - birthYear: 1999 - country: USA - creationDate: "2020-05-05T04:44:45.943Z" - email: Janie.Daniel33@hotmail.com - firstname: Ben - healthcareProviderIDs: - - 5ca68256-6a9a-4cfe-9246-3ddd5ee9580a - - aa6897cf-2c31-41a1-be2c-52ebaf4d50f5 - - aeb55bab-ebe3-4066-9f1a-323502a58c12 - homeCounty: Josianeburgh - imageUrl: null - lastModifiedDate: "2020-05-05T04:44:45.943Z" - lastname: Barrows - middlename: Levin - netid: null - phone: +17972114377 - photoImageBase64: null - pid: c84bfd99-e40d-43d5-854f-33859de593d5 - state: Illinois - testResultsConsent: - consentProvided: true - dateModified: "2020-05-05T04:44:45.943Z" - uin: "100000001" - username: null - uuid: - - 3fa85f64-5717-4562-b3fc-2c963f66afa6 - workCounty: Donnieberg - zipCode: "61801" - 400: - description: Bad request - 401: - description: Unauthorized - 500: - description: Internal error - /profiles/pii/{pid}: - get: - tags: - - PII - summary: Get PII by PID - description: | - Returns a single PII entry. - - Auth: Requires a valid id_token and PID for access. The contents of the id_token (phone number, uin) must match the PII entry contents. - security: - - UserAuth: [] - parameters: - - name: pid - in: path - description: ID of PII to return - required: true - style: simple - explode: false - schema: - type: string - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Pii' - application/xml: - schema: - $ref: '#/components/schemas/Pii' - 400: - description: Invalid ID supplied - 401: - description: Unauthorized - 404: - description: Profile not found - 500: - description: Internal error - put: - tags: - - PII - summary: Updates a PII with form data - description: | - Auth: Requires a valid id_token and PID For access. The contents of the id_token (phone number, uin) must match the old and new PII entry contents (i.e., phone number and uin can't be changed). - security: - - UserAuth: [] - parameters: - - name: pid - in: path - description: ID of PII that needs to be updated - required: true - style: simple - explode: false - schema: - type: string - requestBody: - description: update profile object - content: - application/json: - schema: - $ref: '#/components/schemas/Pii' - example: - address: 2000 Kristina Lights - birthYear: 1999 - country: USA - creationDate: "2020-05-05T04:44:45.943Z" - email: Alice.Bob@hotmail.com - firstname: Ben - healthcareProviderIDs: - - 5ca68256-6a9a-4cfe-9246-3ddd5ee9580a - - aa6897cf-2c31-41a1-be2c-52ebaf4d50f5 - homeCounty: Josianeburgh - imageUrl: null - lastModifiedDate: "2020-05-05T04:44:45.943Z" - lastname: Barrows - middlename: Levin - netid: null - phone: "+17972114377" - photoImageBase64: null - pid: c84bfd99-e40d-43d5-854f-33859de593d5 - state: Illinois - testResultsConsent: - consentProvided: false - dateModified: "2020-05-05T04:44:45.943Z" - uin: "100000001" - username: null - uuid: - - 3fa85f64-5717-4562-b3fc-2c963f66afa6 - workCounty: Donnieberg - zipCode: "61821" - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Pii' - example: - address: 2000 Kristina Lights - birthYear: 1999 - country: USA - creationDate: 2020-05-05T04:44:45.943Z - email: Alice.Bob@hotmail.com - firstname: Ben - healthcareProviderIDs: - - 5ca68256-6a9a-4cfe-9246-3ddd5ee9580a - - aa6897cf-2c31-41a1-be2c-52ebaf4d50f5 - homeCounty: Josianeburgh - imageUrl: null - lastModifiedDate: "2020-05-05T04:44:45.943Z" - lastname: Barrows - middlename: Levin - netid: null - phone: "+17972114377" - photoImageBase64: null - pid: c84bfd99-e40d-43d5-854f-33859de593d5 - state: Illinois - testResultsConsent: - consentProvided: false - dateModified: "2020-05-05T04:44:45.943Z" - uin: "100000001" - username: null - uuid: - - 3fa85f64-5717-4562-b3fc-2c963f66afa6 - workCounty: Donnieberg - zipCode: "61821" - application/xml: - schema: - $ref: '#/components/schemas/Pii' - 400: - description: Invalid ID supplied - 401: - description: Unauthorized - 405: - description: Invalid input - 500: - description: Internal error - delete: - tags: - - PII - summary: Deletes a PII - description: | - Auth: Requires a valid id_token and PID For access. The contents of the id_token (phone number, uin) must match the contents of the PII entry to be deleted. - security: - - UserAuth: [] - parameters: - - name: pid - in: path - description: Pii id to delete - required: true - style: simple - explode: false - schema: - type: string - responses: - 202: - description: Profile is deleted - 400: - description: Invalid ID supplied - 401: - description: Unauthorized - 404: - description: Profile not found - 500: - description: Internal error - /events: - get: - tags: - - Events - summary: searches events - description: | - By passing in the appropriate options, you can search for events matching your criteria in the system - - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - parameters: - - name: title - in: query - description: The parameter for searching events based on keywords in the title. - required: false - style: form - explode: true - schema: - type: string - - name: recurrenceId - in: query - description: The parameter to search events based on a specific recurrence ID. - required: false - style: form - explode: true - schema: - type: integer - - name: tags - in: query - description: Search events with the given tags, e.g., /events?tags=coffee&tags=music. This query will return all events whose tags contain coffee or music - required: false - style: form - explode: true - schema: - type: string - - name: targetAudience - in: query - description: The parameter for searching events based on given input target audience, e.g., /events?targetAudience=students&targetAudience=staff. This query will return all events whose target audience is either students or staff. This parameter is CURRENTLY IGNORED. - required: false - style: form - explode: true - schema: - type: string - - name: startDate - in: query - description: The parameter for searching events based on a given start date, e.g., /events?startDate=2019-04-25T13:00:00. This query will return all events whose start date is equal or after the given input date. - required: false - style: form - explode: true - schema: - type: string - - name: endDate - in: query - description: The parameter for searching events based on a given end date, e.g., /events?endDate=2019-04-25T13:00:00. This query will return all events whose start date is equal or before the given input date. - required: false - style: form - explode: true - schema: - type: string - - name: latitude - in: query - description: The latitude of the center point for geolocation radius search. - required: false - style: form - explode: true - schema: - type: number - - name: longitude - in: query - description: The longitude of the center point for geolocation radius search. - required: false - style: form - explode: true - schema: - type: number - - name: radius - in: query - description: The parameter to search events within a given radius of the provided location in meters, e.g., /events?latitude=40.1078955&longitude=-88.224036&radius=800. This query will return back all events whose geolocation is within 800 meter centered at given geolocation point. - required: false - style: form - explode: true - schema: - type: integer - - name: skip - in: query - description: number of records to skip for pagination - required: false - style: form - explode: true - schema: - minimum: 0 - type: integer - format: int32 - - name: limit - in: query - description: maximum number of records to return - required: false - style: form - explode: true - schema: - maximum: 50 - minimum: 0 - type: integer - format: int32 - - name: id - in: query - description: The parameter for searching multiple events based on their IDs. - required: false - style: form - explode: true - schema: - type: string - - name: superEventId - in: query - description: The parameter for searching sub events based on the ID of a super event. - required: false - style: form - explode: true - schema: - type: string - responses: - 200: - description: search results matching criteria - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Event' - - 401: - description: Unauthorized - 404: - description: Event not found - 500: - description: Internal error - post: - tags: - - Events - summary: create an event - description: | - create an event record into the system - - Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: - ``` - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers - ``` - security: - - UserAuth: [] - requestBody: - description: Created event object - content: - application/json: - schema: - $ref: '#/components/schemas/Event' - required: true - responses: - 201: - description: Events created - content: - application/json: - schema: - $ref: '#/components/schemas/Event' - 400: - description: Bad request - 401: - description: Unauthorized - 500: - description: Internal error - - /events/{event_id}: - get: - tags: - - Events - summary: Get one event by the given event id. - description: | - Get the event record matching the eventId. - - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - parameters: - - name: event_id - in: path - description: ID of the event that needs to be updated - required: true - style: simple - explode: false - schema: - type: string - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Event' - application/xml: - schema: - $ref: '#/components/schemas/Event' - 400: - description: Invalid ID supplied - 401: - description: Unauthorized - 500: - description: Internal error - put: - tags: - - Events - summary: Updates one event with form data - description: | - Update the event record matching the eventId. - - Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: - ``` - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers - ``` - security: - - UserAuth: [] - parameters: - - name: event_id - in: path - description: ID of the event that needs to be updated - required: true - style: simple - explode: false - schema: - type: string - requestBody: - description: update one event object - content: - application/json: - schema: - $ref: '#/components/schemas/Event' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Event' - application/xml: - schema: - $ref: '#/components/schemas/Event' - 400: - description: Invalid ID supplied - 401: - description: Unauthorized - 405: - description: Invalid input - 500: - description: Internal error - delete: - tags: - - Events - summary: Deletes an event by the given event id - description: | - Delete the event record matching the eventId. - - Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: - ``` - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers - ``` - security: - - UserAuth: [] - parameters: - - name: event_id - in: path - description: event id to delete - required: true - style: simple - explode: false - schema: - type: string - responses: - 202: - description: Event is deleted - 400: - description: Invalid ID supplied - 401: - description: Unauthorized - 404: - description: Event not found - patch: - tags: - - Events - summary: Updates one event with form data - description: | - Update the event record matching the eventId. - - Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: - ``` - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers - ``` - security: - - UserAuth: [] - parameters: - - name: event_id - in: path - description: ID of the event that needs to be updated - required: true - style: simple - explode: false - schema: - type: string - requestBody: - description: patch one event object - content: - application/json: - schema: - $ref: '#/components/schemas/Event' - required: true - responses: - 200: - description: successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Event' - application/xml: - schema: - $ref: '#/components/schemas/Event' - 400: - description: Invalid ID supplied - 401: - description: Unauthorized - 405: - description: Invalid input - 500: - description: Internal error - /events/categories: - get: - tags: - - Events - summary: Get events categories - description: | - return back a list of categories and subcategories - - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - responses: - 200: - description: search results matching criteria - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Categories' - - 401: - description: Unauthorized - 404: - description: Event not found - 500: - description: Internal error - /events/tags: - get: - tags: - - Events - summary: Get a list of Rokwire event tags - description: | - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - responses: - 200: - description: Getting event tags successful - content: - application/json: - schema: - type: array - items: - type: string - 500: - description: Internal error - /events/super-events/tags: - get: - tags: - - Events - summary: Get a list of Rokwire super event tags - description: | - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - responses: - 200: - description: Getting super event tags successful - content: - application/json: - schema: - type: array - items: - type: string - 500: - description: Internal error - /events/{event_id}/images: - get: - tags: - - Events - summary: Get IDs of all images associated with the requested event. - description: | - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - parameters: - - name: event_id - in: path - description: Event ID - required: true - schema: - type: string - responses: - 200: - description: Getting image IDs successful. - content: - multipart/form-data: - schema: - type: array - items: - type: string - format: binary - 500: - description: Internal error - post: - tags: - - Events - summary: Upload an image to the specified event - description: | - Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: - ``` - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers - ``` - security: - - UserAuth: [] - requestBody: - description: Image file to upload and associate with the requested event - content: - image/*: - schema: - type: string - format: binary - minLength: 1 - maxLength: 5000000 - parameters: - - name: event_id - in: path - description: Event ID - required: true - schema: - type: string - responses: - 201: - description: Images uploaded - content: - application/json: - schema: - type: object - properties: - status: - type: integer - description: Operation status code - id: - type: integer - format: int64 - description: Image ID - message: - type: string - description: The description of the operation - 500: - description: Internal error - - /events/{event_id}/images/{image_id}: - get: - tags: - - Events - summary: Download an event image by providing the IDs of the event and the image. - description: | - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - parameters: - - name: event_id - in: path - description: Event ID - required: true - schema: - type: string - - name: image_id - in: path - description: Requested image ID - required: true - schema: - type: string - responses: - 200: - description: Successful image download - content: - image/jpeg: - schema: - type: string - format: binary - 500: - description: Internal Error - - put: - tags: - - Events - summary: Update an image associated with the specified event - description: | - Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: - ``` - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers - ``` - security: - - UserAuth: [] - requestBody: - description: Image file to add to the event - content: - image/*: - schema: - type: string - format: binary - minLength: 1 - maxLength: 5000000 - parameters: - - name: event_id - in: path - description: Event ID - required: true - schema: - type: string - - name: image_id - in: path - description: Requested image ID - required: true - schema: - type: string - responses: - 200: - description: Image updated - content: - application/json: - schema: - type: object - properties: - status: - type: integer - description: Operation status code - id: - type: integer - format: int64 - description: Event ID - message: - type: string - description: The description of the operation - 500: - description: Internal error - - delete: - tags: - - Events - summary: Delete an image associated with the specified event - description: | - Auth: Requires a valid id_token that indicates membership in at least one of the following groups\: - ``` - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events manager - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire ems events uploader - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire events web app - urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire event approvers - ``` - security: - - UserAuth: [] - parameters: - - name: event_id - in: path - description: Event ID - required: true - schema: - type: string - - name: image_id - in: path - description: ID of the image that needs to be deleted - required: true - schema: - type: string - responses: - 202: - description: Image is deleted - content: - application/json: - schema: - type: object - properties: - status: - type: integer - description: Operation status code - id: - type: integer - format: int64 - description: Event ID - message: - type: string - description: The description of the operation - 500: - description: Internal error - - /app/configs: - post: - tags: - - App Configuration - summary: Creates mobile app configuration - description: | - Auth: Requires a valid id_token that indicates membership in the following group\: - - ```urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire app config manager``` - security: - - UserAuth: [] - requestBody: - description: Creates AppConfig object - content: - application/json: - schema: - $ref: '#/components/schemas/AppConfig' - examples: - withoutSecretKeys: - value: - mobileAppVersion: "1.0.1" - platformBuildingBlocks: - appconfig: https://api.rokwire.illinois.edu/app/configs - profile: https://api.rokwire.illinois.edu/profiles - thirdPartyServices: - facebook: https://facebook.com - instagram_url: https://instagram.com - otherUniversityServices: - illini_cash_base_url: https://shibtest.housing.illinois.edu/MobileAppWS/api - secretKeys: "" - upgrade: - available_version: "1.0.2" - required_version: "1.0.0" - "url": - "android": "market://details?id=com.dropbox.android" - "ios": "itms-apps://itunes.apple.com/us/app/apple-store/id327630330" - withSecretKeys: - value: - mobileAppVersion: "1.0.2" - platformBuildingBlocks: - appconfig: https://api.rokwire.illinois.edu/app/configs - profile: https://api.rokwire.illinois.edu/profiles - thirdPartyServices: - facebook: https://facebook.com - instagram_url: https://instagram.com - otherUniversityServices: - illini_cash_base_url: https://shibtest.housing.illinois.edu/MobileAppWS/api - secretKeys: "123abc456" - upgrade: - available_version: "1.0.2" - required_version: "1.0.0" - "url": - "android": "market://details?id=com.dropbox.android" - "ios": "itms-apps://itunes.apple.com/us/app/apple-store/id327630330" - required: true - responses: - 201: - description: AppConfig created - content: - application/json: - schema: - $ref: '#/components/schemas/AppConfig' - 400: - description: Bad request - 401: - description: Unauthorized - 500: - description: Internal error - get: - tags: - - App Configuration - summary: Reads mobile app configuration - description: | - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - parameters: - - name: mobileAppVersion - in: query - description: query by mobile app version, results contain all app configurations if no paramer is given; If given mobileAppVersion, it will return the closest app config that is less than or equal to the given version. - style: form - explode: false - schema: - type: string - responses: - 200: - description: successfully read mobile app configuration - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/AppConfig' - 400: - description: Bad request. - 401: - description: Unauthorized - 404: - description: AppConfig not found - 500: - description: Internal error - /app/configs/{id}: - get: - tags: - - App Configuration - summary: Reads mobile app configuration by given id - description: | - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - parameters: - - name: id - in: path - description: app config id to read - required: true - style: simple - explode: false - schema: - type: string - responses: - 200: - description: successfully read mobile app configuration - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/AppConfig' - 400: - description: Bad request. - 401: - description: Unauthorized - 404: - description: AppConfig not found - 500: - description: Internal error - put: - tags: - - App Configuration - summary: Updates mobile app configuration - description: | - Auth: Requires a valid id_token that indicates membership in the following group\: - - ```urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire app config manager``` - security: - - UserAuth: [] - parameters: - - name: id - in: path - description: app config id to update - required: true - style: simple - explode: false - schema: - type: string - requestBody: - description: update AppConfig object - content: - application/json: - schema: - $ref: '#/components/schemas/AppConfig' - required: true - responses: - 200: - description: successfully updated mobile app configuration - content: - application/json: - schema: - $ref: '#/components/schemas/AppConfig' - 401: - description: Unauthorized - 405: - description: Invalid input - 500: - description: Internal error - delete: - tags: - - App Configuration - summary: Deletes mobile app configuration - description: | - Auth: Requires a valid id_token that indicates membership in the following group\: - - ```urn:mace:uiuc.edu:urbana:authman:app-rokwire-service-policy-rokwire app config manager``` - security: - - UserAuth: [] - parameters: - - name: id - in: path - description: app config id to delete - required: true - style: simple - explode: false - schema: - type: string - responses: - 202: - description: AppConfig deleted - 401: - description: Unauthorized - 404: - description: AppConfig not found - 500: - description: Internal error - /logs: - post: - tags: - - Logs - summary: Create log entries - description: | - Create log entries from the app. - - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - requestBody: - description: A JSON array of one or more log entries. The schema of the request body is only provided as a reference and by default all of its properties are optional. - required: true - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Logs" - example: - - timestamp: "2019-10-05T16:16:50Z" - uuid: "e696663c-06fa-4f23-9427-4376849acb73" - os: ios - osVersion: "12.4" - appVersion: "0.9.5" - device: Samsung Galaxy s10 - deviceSettings: {} - userAction: - type: view - name: homePanel - mainFeature: Home - subFeature: Explore - - timestamp: "2019-10-05T16:16:51Z" - uuid: "e696663c-06fa-4f23-9427-4376849acb73" - os: ios - osVersion: "12.4" - appVersion: "0.9.5" - device: Samsung Galaxy s10 - deviceSettings: {} - userAction: - type: view - name: homePanel - mainFeature: Home - subFeature: Explore - customAttribute1: Double click - responses: - 200: - description: OK - 400: - description: Bad request - 401: - description: Unauthorized - 500: - description: Internal error - - /authentication/phone-initiate: - post: - summary: Initiate phone number verification - description: | - Step 1 of 2 for phone number verification. Initiates the verification with a text or - call that contains a code. That code should then be provided to the - /authentication/phone-verify endpoint. Note: The phoneNumber property must include a - prefix plus symbol (+), the country code (e.g., 1 for USA), and the area code. - - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - tags: - - Authentication - operationId: auth_rest_service.initiate_verification - responses: - 201: - description: initiation successful - 400: - description: bad request - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AuthPhoneVerifyInitBody' - examples: - sms: - value: - phoneNumber: "+12175557890" - channel: "sms" - call: - value: - phoneNumber: "+12175557890" - channel: "call" - /authentication/phone-verify: - post: - summary: Complete phone number verification - description: | - Step 2 of 2 for phone number verification. The request body should contain the code - that was sent to the end user as a result of the /authentication/phone-initiate - endpoint. phone-verify will check if the code matches what was originally sent to - the user. Note: The phoneNumber property must include a prefix plus symbol (+), - the country code (e.g., 1 for USA), and the area code. - - Auth: Requires a valid API Key for access. - security: - - ApiKeyAuth: [] - tags: - - Authentication - operationId: auth_rest_service.verification_check - responses: - 200: - description: the result of the verification - content: - application/json: - schema: - oneOf: - - type: object - properties: - success: - type: boolean - enum: - - true - id_token: - type: string - required: - - success - - id_token - - type: object - properties: - success: - type: boolean - enum: - - false - required: - - success - example: - success: true - id_token: deadbeef1234 - 400: - description: bad request - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/AuthPhoneVerifyCheckBody' -components: - schemas: - Non-pii: - type: object - nullable: true - properties: - uuid: - type: string - format: uuid - over13: - nullable: true - type: boolean - interests: - type: array - items: - properties: - category: - type: string - subcategories: - type: array - items: - type: string - positiveInterestTags: - nullable: true - type: array - items: - type: string - negativeInterestTags: - nullable: true - type: array - items: - type: string - favorites: - nullable: true - type: object - items: - properties: - eventIds: - type: array - items: - type: string - placeIds: - type: array - items: - type: string - diningPlaceIds: - type: array - items: - type: string - laundryPlaceIds: - type: array - items: - type: string - athleticEventIds: - type: array - items: - type: string - privacySettings: - nullable: true - type: object - properties: - level: - type: integer - enum: - - 1 - - 2 - - 3 - - 4 - - 5 - dataModified: - type: string - creationDate: - type: string - lastModifiedDate: - type: string - Pii: - type: object - properties: - pid: - type: string - uuid: - oneOf: - - type: string - format: uuid - - type: array - items: - type: string - format: uuid - userName: - nullable: true - type: string - firstname: - nullable: true - type: string - lastname: - nullable: true - type: string - middlename: - nullable: true - type: string - email: - nullable: true - type: string - phone: - nullable: true - type: string - birthYear: - nullable: true - type: integer - format: int8 - address: - nullable: true - type: string - zipCode: - nullable: true - type: string - homeCounty: - nullable: true - type: string - workCounty: - nullable: true - type: string - state: - nullable: true - type: string - country: - nullable: true - type: string - healthcareProviderIDs: - nullable: true - type: array - items: - type: string - testResultsConsent: - type: object - nullable: true - properties: - consentProvided : - type: boolean - dateModified: - type: string - photoImageBase64: - nullable: true - type: string - format: byte - imageUrl: - nullable: true - type: string - documentType: - description: The type of the user document that was scanned to populate certain PII fields like name, photoImage, birthYear, etc. - type: string - nullable: true - enum: - - passport - - drivingLicense - creationDate: - description: creation date will not be modified once it get set. - type: string - lastModifiedDate: - description: last modified date will be updated in the endpoint not from the input request. - type: string - NonPIIDeviceData: - type: object - nullable: true - properties: - deviceToken: - type: string - uuid: - type: string - format: uuid - Event: - required: - - title - - startDate - - category - type: object - properties: - id: - type: string - description: the event id - sourceEventId: - type: string - description: The ID of the event in the original event source (e.g., WebTools, EMS, etc.) - recurringFlag: - type: boolean - description: a flag to denote this is recurring event - recurrenceId: - type: integer - description: recurring id - category: - type: string - enum: - - Entertainment - - Academic - - Community - - Career Development - - Recreation - - Athletics - - Other - subcategory: - type: string - dateCreated: - type: string - format: date-time - createdBy: - type: string - sponsor: - type: string - description: For example, Center for Advanced Study - title: - type: string - subTitle: - type: string - titleURL: - type: string - description: Title URL representing the event title. For example, https://cas.illinois.edu/node/190 - longDescription: - type: string - shortDescription: - type: string - startDate: - type: string - format: date-time - endDate: - type: string - format: date-time - targetAudience: - type: array - items: - type: "string" - enum: - - students - - faculty - - staff - - alumni - - parents - - public - imageUrl: - type: string - icalUrl: - type: string - outlookUrl: - type: string - speaker: - type: string - registrationLabel: - type: string - registrationURL: - type: string - cost: - type: string - description: For example, Free and open to the public. - contacts: - type: array - xml: - name: "contact" - wrapped: true - items: - $ref: "#/components/schemas/Contact" - tags: - type: array - xml: - name: tag - wrapped: true - items: - type: string - placeId: - type: string - location: - $ref: "#/components/schemas/Location" - dateModified: - type: string - description: store a timestamp when this event was modified. - format: date-time - submissionStatus: - type: string - description: store the status of this event submission - enum: - - submitted - - published - - rejected - - incomplete - - archived - isSuperEvent: - type: boolean - description: States whether an event is a super event (`true`) or not (`false`). A super event is defined as an event that contains one more sub events. E.g. conference, workshop, exhibition, etc. Each sub event can be a featured sub event and can contain a track that the sub event belongs to. - subEvents: - type: array - description: A list of objects containg some basic details about the sub events that are part of a super event. This property currently applies only to a super event. I.e. this assumes that `isSuperEvent` is set to `true`. - items: - $ref: "#/components/schemas/SubEventDetails" - SubEventDetails: - type: object - properties: - id: - type: string - description: ID of the sub event. A sub event is a regular event, except that it's associated with a another event called a super event. - isFeatured: - type: boolean - description: Inidicates whether a sub event is a featured sub event (`true`) or not (`false`). This property can be used to highlight a sub event. - track: - type: string - description: Stores the track or a category that the sub event belongs to. This property can be used to group one or more sub events that are part of a super event. Here, we are using the term *track* in order to differentiate this from the *category* property that is part of the *Event* object. - Categories: - type: object - properties: - category: - type: string - subcategories: - type: array - items: - $ref: '#/components/schemas/SubCategory' - SubCategory: - type: string - Location: - type: object - properties: - locationId: - type: string - room: - type: string - building: - type: string - address: - type: string - latitude: - type: number - description: Latitude component of location. - longitude: - type: number - description: Longitude component of location. - description: - type: string - description: Description of the building from WebTools, e.g., Krannert Center for the Performing Arts, 500 S Goodwin Ave, Urbana. - floor: - type: integer - Contact: - type: object - properties: - firstName: - type: string - lastName: - type: string - email: - type: string - phone: - type: string - organization: - type: string - xml: - name: "Contact" - AppConfig: - type: object - properties: - id: - type: string - mobileAppVersion: - type: string - description: unique and is empty or conforms major.minor.patch format - platformBuildingBlocks: - type: object - thirdPartyServices: - type: object - otherUniversityServices: - type: object - secretKeys: - type: string - upgrade: - type: object - properties: - available_version: - type: string - required_version: - type: string - url: - type: object - properties: - android: - type: string - ios: - type: string - required: - - mobileAppVersion - - platformBuildingBlocks - - thirdPartyServices - - otherUniversityServices - - secretKeys - Logs: - type: object - properties: - timestamp: - type: string - format: date-time - description: Timestamp of the log event as defined by RFC 3339 in the format YYYY-MM-DDThh:mm:ssZ - uuid: - type: string - format: uuid - description: UUID of the app user. - os: - type: string - description: Name of operating system on the device running the app. - osVersion: - type: string - description: Version of operating system on the device running the app. - appVersion: - type: string - description: App version. - device: - type: string - description: Name of device running the app. - deviceSettings: - type: object - description: Object containing relevant device settings. - userAction: - $ref: '#/components/schemas/UserAction' - UserAction: - type: object - description: Object containing details of user action. - properties: - type: - type: string - description: Type of user action. Examples can be 'click', 'view', etc. - name: - type: string - description: Name of user action. This can include the page user is viewing or the UI widget the user is clicking on when generating a log entry. This property can depend on the user action type. - mainFeature: - type: string - description: Name of the main feature that the user is using when generating a log entry. - subFeature: - type: string - description: Name of the sub-feature that the user is using when generating a log entry. - customAttribute1: - type: string - description: Custom attribute provided for future use. - customAttribute2: - type: string - description: Custom attribute provided for future use. - customAttribute3: - type: string - description: Custom attribute provided for future use. - customAttribute4: - type: string - description: Custom attribute provided for future use. - customAttribute5: - type: string - description: Custom attribute provided for future use. - PhoneNumber: - type: string - minLength: 4 - maxLength: 20 - example: "+12175557890" - AuthPhoneVerifyInitBody: - type: object - properties: - phoneNumber: - $ref: '#/components/schemas/PhoneNumber' - channel: - type: string - enum: - - sms - - call - required: - - phoneNumber - - channel - example: - phoneNumber: "+12175557890" - channel: "sms" - AuthPhoneVerifyCheckBody: - type: object - properties: - phoneNumber: - $ref: '#/components/schemas/PhoneNumber' - code: - type: string - minLength: 6 - maxLength: 6 - required: - - phoneNumber - - code - example: - phoneNumber: "+12175557890" - code: "123456" - securitySchemes: - ApiKeyAuth: - type: apiKey - in: header - name: ROKWIRE-API-KEY - x-apikeyInfoFunc: auth_middleware.verify_apikey - description: Each client version has unique API key (e.g., "c6befa22-50a6-4403-a8fc-378c9719743b"). For API endpoints that do not require user authentication, the ROKWIRE-API-KEY header must contain an API key corresponding to a supported client. - UserAuth: - type: http - scheme: bearer - bearerFormat: JWT # https://openid.net/specs/openid-connect-core-1_0.html [id_token] - x-bearerInfoFunc: auth_middleware.verify_userauth - description: The client must send a valid (i.e., signed, not expired) OpenID Connect id_token in the Authorization header when making requests to API endpoints that require user authentication. From 2158125da03a28af3cd48250033a921d811a8074 Mon Sep 17 00:00:00 2001 From: Wenjie Date: Fri, 17 Jul 2020 13:25:42 -0500 Subject: [PATCH 08/29] Task/499 fix auth vulnerabilities (#506) * Update Dockerfile * Update CHANGELOG.md Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 8 ++++---- authservice/Dockerfile | 12 +++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b207d218..7baba2d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,14 +13,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) - Update Swagger-UI version. [#500](https://github.com/rokwire/rokwire-building-blocks-api/issues/500) - -### Changed -- OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) -- Rokwire API Doc Dockerfile to integrate multiple OpenAPI specifications file. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) +- Rokwire API Doc Dockerfile to integrate multiple OpenAPI specifications file. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) ### Removed - rokwire.yaml file and deployment scripts that were not getting used. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) +### Fixed +- Docker image vulnerabilities in Authentication Building Block. [#499](https://github.com/rokwire/rokwire-building-blocks-api/issues/499) + ## [1.6.0] - 2020-07-14 - Add Health Building Block APIs documentation. [#468](https://github.com/rokwire/rokwire-building-blocks-api/issues/468) - Code of Conduct. [#487](https://github.com/rokwire/rokwire-building-blocks-api/issues/487) diff --git a/authservice/Dockerfile b/authservice/Dockerfile index 4fd7f128..69cf82f8 100644 --- a/authservice/Dockerfile +++ b/authservice/Dockerfile @@ -1,10 +1,16 @@ -FROM python:3 +FROM python:3-alpine -LABEL maintainer="fhena2@illinois.edu" +LABEL maintainer="wzhu26@illinois.edu" WORKDIR /app COPY authservice /app/ COPY lib /lib/ -RUN pip install -r /app/requirements.txt +COPY authservice/auth.yaml . + +RUN apk --update add python py-pip openssl ca-certificates py-openssl && \ + apk --update add --virtual build-dependencies libffi-dev openssl-dev python-dev py-pip build-base && \ + pip install --upgrade pip && \ + pip install -r /app/requirements.txt --no-cache-dir && \ + apk del build-dependencies CMD ["gunicorn", "auth_rest_service:app", "--config", "/app/gunicorn.config.py"] From c7c20d82ba2de17027615710ce99d82407ab0ead Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Tue, 21 Jul 2020 11:03:50 -0500 Subject: [PATCH 09/29] Add CODEOWNERS file. (#509) --- CHANGELOG.md | 1 + CODEOWNERS | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 CODEOWNERS diff --git a/CHANGELOG.md b/CHANGELOG.md index 7baba2d8..854e2294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Standard License Header for Events Building Block. [#480](https://github.com/rokwire/rokwire-building-blocks-api/issues/480) - Add Standard License Header for Authentication Building Block [#497](https://github.com/rokwire/rokwire-building-blocks-api/issues/497) - Add Standard License Header for Authentication Library. [#498](https://github.com/rokwire/rokwire-building-blocks-api/issues/498) +- Add CODEOWNERS file. [#508](https://github.com/rokwire/rokwire-building-blocks-api/issues/508) ### Changed - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000..863b1413 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,24 @@ +# Default assignment +* @sandeep-ps + +# App Config Building Block +/appconfigservice/ @wenjzhu + +# Authentication Building Block +/authservice/ @wenjzhu + +# Authentication Middleware Library +/lib/auth-middleware/ @ywkim312 + +# API Doc +/Dockerfile @sandeep-ps +/README @sandeep-ps + +# Events Building Block +/eventservice/ @bingzhang + +# Logging Building Block +/loggingservice/ @ywkim312 + +# Profile Building Block +/profileservice/ @ywkim312 From 7db8f5ae45b82dc0d8a7501e71929961dfd90f13 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Tue, 21 Jul 2020 14:07:20 -0500 Subject: [PATCH 10/29] Add Standard License Header for API Doc. (#507) --- CHANGELOG.md | 1 + Dockerfile | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 854e2294..9be01122 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Standard License Header for Authentication Building Block [#497](https://github.com/rokwire/rokwire-building-blocks-api/issues/497) - Add Standard License Header for Authentication Library. [#498](https://github.com/rokwire/rokwire-building-blocks-api/issues/498) - Add CODEOWNERS file. [#508](https://github.com/rokwire/rokwire-building-blocks-api/issues/508) +- Add Standard License Header for API Doc. [#501](https://github.com/rokwire/rokwire-building-blocks-api/issues/501) ### Changed - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) diff --git a/Dockerfile b/Dockerfile index 45a4cbc7..ad9b670e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,17 @@ +# Copyright 2020 Board of Trustees of the University of Illinois. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM swaggerapi/swagger-ui:v3.28.0 COPY appconfigservice/appconfig.yaml /usr/share/nginx/html/app/ From 079c924d4c02c8c24d0e0ee53e77421c6cf1f342 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Tue, 21 Jul 2020 16:50:11 -0500 Subject: [PATCH 11/29] Update issue templates (#511) * Update issue templates Add issue templates for bug report and feature request. * Update CHANGELOG.md --- .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++ CHANGELOG.md | 1 + 3 files changed, 59 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..dd84ea78 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..bbcbbe7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/CHANGELOG.md b/CHANGELOG.md index 9be01122..86f49889 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Standard License Header for Authentication Library. [#498](https://github.com/rokwire/rokwire-building-blocks-api/issues/498) - Add CODEOWNERS file. [#508](https://github.com/rokwire/rokwire-building-blocks-api/issues/508) - Add Standard License Header for API Doc. [#501](https://github.com/rokwire/rokwire-building-blocks-api/issues/501) +- Add bug report and feature request issue templates. [#510](https://github.com/rokwire/rokwire-building-blocks-api/issues/510) ### Changed - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) From b4171125b28ce304877f0fbc28165652cda9543e Mon Sep 17 00:00:00 2001 From: Bing Zhang Date: Fri, 24 Jul 2020 12:08:40 -0500 Subject: [PATCH 12/29] Eventsbuildingblock dockerfile alpine (#513) * fix docker vulnerability * Update eventservice/Dockerfile * Update CHANGELOG.md Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 1 + eventservice/Dockerfile | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86f49889..042248c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Docker image vulnerabilities in Authentication Building Block. [#499](https://github.com/rokwire/rokwire-building-blocks-api/issues/499) +- Docker image vulnerabilities in Events Building Block. [#484](https://github.com/rokwire/rokwire-building-blocks-api/issues/484) ## [1.6.0] - 2020-07-14 - Add Health Building Block APIs documentation. [#468](https://github.com/rokwire/rokwire-building-blocks-api/issues/468) diff --git a/eventservice/Dockerfile b/eventservice/Dockerfile index 82a6e9b9..584a9f03 100644 --- a/eventservice/Dockerfile +++ b/eventservice/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3 +FROM python:3-alpine3.11 LABEL maintainer="bing@illinois.edu" @@ -8,7 +8,14 @@ WORKDIR /app COPY eventservice/events.yaml /app/ COPY eventservice /app/eventservice/ COPY lib /lib/ -RUN pip install -r /app/eventservice/requirements.txt + + +RUN apk --update add python3 py3-pip openssl ca-certificates py3-openssl && \ + apk --update add --virtual build-dependencies libffi-dev openssl-dev python3-dev py3-pip build-base && \ + pip install --upgrade pip && \ + pip install -r /app/eventservice/requirements.txt --no-cache-dir && \ + apk del build-dependencies + VOLUME /var/cache/app WORKDIR /app/eventservice/api From 52e56ef1df0ec3000ae0222c80b46bf01736709d Mon Sep 17 00:00:00 2001 From: Wenjie Date: Wed, 29 Jul 2020 00:04:44 -0500 Subject: [PATCH 13/29] Update Dockerfile base image for appconfig (#516) * Update Dockerfile * Update CHANGELOG.md --- CHANGELOG.md | 1 + appconfigservice/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 042248c6..36605bb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) - Update Swagger-UI version. [#500](https://github.com/rokwire/rokwire-building-blocks-api/issues/500) - Rokwire API Doc Dockerfile to integrate multiple OpenAPI specifications file. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) +- Update Appconfig Building Block docker base image. [#515](https://github.com/rokwire/rokwire-building-blocks-api/issues/515) ### Removed - rokwire.yaml file and deployment scripts that were not getting used. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) diff --git a/appconfigservice/Dockerfile b/appconfigservice/Dockerfile index a9d8198e..b9f59f7d 100644 --- a/appconfigservice/Dockerfile +++ b/appconfigservice/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3-alpine +FROM python:3-alpine3.11 LABEL maintainer="wzhu26@illinois.edu" From eaf9d389b8658102d72520fcf5a47eb6a4300f90 Mon Sep 17 00:00:00 2001 From: Wenjie Date: Wed, 29 Jul 2020 00:05:58 -0500 Subject: [PATCH 14/29] Update Dockerfile base image for auth building block (#518) * Update Dockerfile * Update CHANGELOG.md Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 1 + authservice/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36605bb1..971695fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update Swagger-UI version. [#500](https://github.com/rokwire/rokwire-building-blocks-api/issues/500) - Rokwire API Doc Dockerfile to integrate multiple OpenAPI specifications file. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) - Update Appconfig Building Block docker base image. [#515](https://github.com/rokwire/rokwire-building-blocks-api/issues/515) +- Update Authentication Building Block docker base image. [#517](https://github.com/rokwire/rokwire-building-blocks-api/issues/517) ### Removed - rokwire.yaml file and deployment scripts that were not getting used. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) diff --git a/authservice/Dockerfile b/authservice/Dockerfile index 69cf82f8..151a42de 100644 --- a/authservice/Dockerfile +++ b/authservice/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3-alpine +FROM python:3-alpine3.11 LABEL maintainer="wzhu26@illinois.edu" From 3b1b35f3d5129f09b3b43dc451116a350a805a0d Mon Sep 17 00:00:00 2001 From: Wenjie Date: Wed, 29 Jul 2020 00:07:28 -0500 Subject: [PATCH 15/29] Update README.md for authentication building block (#520) * Update README.md * Update CHANGELOG.md Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 1 + authservice/{readme.md => README.md} | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) rename authservice/{readme.md => README.md} (92%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 971695fd..84a115fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Rokwire API Doc Dockerfile to integrate multiple OpenAPI specifications file. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) - Update Appconfig Building Block docker base image. [#515](https://github.com/rokwire/rokwire-building-blocks-api/issues/515) - Update Authentication Building Block docker base image. [#517](https://github.com/rokwire/rokwire-building-blocks-api/issues/517) +- Update Authentication Building Block README [#519](https://github.com/rokwire/rokwire-building-blocks-api/issues/519) ### Removed - rokwire.yaml file and deployment scripts that were not getting used. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) diff --git a/authservice/readme.md b/authservice/README.md similarity index 92% rename from authservice/readme.md rename to authservice/README.md index 75750116..dd8f561c 100644 --- a/authservice/readme.md +++ b/authservice/README.md @@ -50,16 +50,17 @@ $ python auth_rest_service.py ``` ### Run as a Docker Container -#### Docker Compose - You need to have Docker installed in your computer. -##### Run command +##### Build Docker Image and Run with Docker command ``` -$ docker-compose up +docker build -f authservice/Dockerfile -t rokwire/authentication-building-block:latest . +docker run --name auth --rm --env-file=authservice/.env -e -p AUTH_URL_PREFIX= 5000:5000 rokwire/authentication-building-block:latest ``` +Or update `docker-compose.yml` file and use `docker-compose up` to run + ##### Docker Compose environment variable configuration To run locally with Docker Compose, you will need to create a file called `.env`. See [here](https://docs.docker.com/compose/environment-variables/#the-env-file) for documentation on `.env` files. Here are the environment variables that need to be defined: From c3f2c987b29fb7874b8c1b5a6c24fe1fbe498dc4 Mon Sep 17 00:00:00 2001 From: ywkim312 Date: Wed, 29 Jul 2020 00:10:50 -0500 Subject: [PATCH 16/29] Change docker base image in Profile and Logging Building Blocks (#522) * changed the docker base image * updated changelog Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 1 + loggingservice/Dockerfile | 2 +- profileservice/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84a115fb..1f393e7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update Appconfig Building Block docker base image. [#515](https://github.com/rokwire/rokwire-building-blocks-api/issues/515) - Update Authentication Building Block docker base image. [#517](https://github.com/rokwire/rokwire-building-blocks-api/issues/517) - Update Authentication Building Block README [#519](https://github.com/rokwire/rokwire-building-blocks-api/issues/519) +- Changed docker base image for Profile and Logging Building Block. [#521](https://github.com/rokwire/rokwire-building-blocks-api/issues/521) ### Removed - rokwire.yaml file and deployment scripts that were not getting used. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) diff --git a/loggingservice/Dockerfile b/loggingservice/Dockerfile index 349225c2..8f9b8425 100644 --- a/loggingservice/Dockerfile +++ b/loggingservice/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3-alpine +FROM python:3-alpine3.11 LABEL maintainer="ywkim@illinois.edu" diff --git a/profileservice/Dockerfile b/profileservice/Dockerfile index 24c7de71..77c2609f 100644 --- a/profileservice/Dockerfile +++ b/profileservice/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3-alpine +FROM python:3-alpine3.11 LABEL maintainer="ywkim@illinois.edu" From 0b40ebdba06d5d204fa023defb073de22c49aad3 Mon Sep 17 00:00:00 2001 From: Petyo Stoyanov Date: Tue, 4 Aug 2020 06:17:28 +0300 Subject: [PATCH 17/29] [TASK-528] Add Talent Chooser BB documentation (#529) * Update CHANGELOG.md * Add Talent Chooser BB yaml definition. --- CHANGELOG.md | 1 + Dockerfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f393e7a..73a954ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add CODEOWNERS file. [#508](https://github.com/rokwire/rokwire-building-blocks-api/issues/508) - Add Standard License Header for API Doc. [#501](https://github.com/rokwire/rokwire-building-blocks-api/issues/501) - Add bug report and feature request issue templates. [#510](https://github.com/rokwire/rokwire-building-blocks-api/issues/510) +- Add Talent Chooser Building Block APIs documentation. [#528](https://github.com/rokwire/rokwire-building-blocks-api/issues/528) ### Changed - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) diff --git a/Dockerfile b/Dockerfile index ad9b670e..1b808d0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ COPY eventservice/events.yaml /usr/share/nginx/html/app/ COPY profileservice/profile.yaml /usr/share/nginx/html/app/ COPY loggingservice/logging.yaml /usr/share/nginx/html/app/ -ENV URLS "[{url: 'app/appconfig.yaml', name: 'App Config Building Block'}, {url: 'app/auth.yaml', name: 'Authentication Building Block'}, {url: 'app/events.yaml', name: 'Events Building Block'}, {url: 'app/profile.yaml', name: 'Profile Building Block'}, {url: 'app/logging.yaml', name: 'Logging Building Block'}, {url: 'https://api-dev.rokwire.illinois.edu/health/doc', name: 'Health Building Block'} ]" +ENV URLS "[{url: 'app/appconfig.yaml', name: 'App Config Building Block'}, {url: 'app/auth.yaml', name: 'Authentication Building Block'}, {url: 'app/events.yaml', name: 'Events Building Block'}, {url: 'app/profile.yaml', name: 'Profile Building Block'}, {url: 'app/logging.yaml', name: 'Logging Building Block'}, {url: 'https://api-dev.rokwire.illinois.edu/health/doc', name: 'Health Building Block'}, {url: 'https://api-dev.rokwire.illinois.edu/talent-chooser/doc', name: 'Talent Chooser Building Block'} ]" VOLUME /usr/share/nginx/html/app/ From 8fbc4a01c0dd213847cefc4c9a65d517b3578ef8 Mon Sep 17 00:00:00 2001 From: ywkim312 Date: Tue, 4 Aug 2020 16:35:51 -0500 Subject: [PATCH 18/29] modified readme instruction for profiles and logging (#526) * modified readme * modified readme for profile * Update profileservice/README.md Co-authored-by: Sandeep Puthanveetil Satheesan --- loggingservice/README.md | 8 ++++---- profileservice/README.md | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/loggingservice/README.md b/loggingservice/README.md index 2e9d9f13..cf4ef72d 100644 --- a/loggingservice/README.md +++ b/loggingservice/README.md @@ -29,14 +29,14 @@ AWS_SECRET_ACCESS_KEY= ``` ## Run in Development Mode - ``` -cd loggingservice export FLASK_ENV=development -python logging_rest_service.py +python api/logging_rest_service.py ``` and the Logging Building Block should be running at localhost at port 5000 (http://localhost:5000/logs). The detailed API information is in logging.yaml in the OpenAPI Spec 3.0 format. +If you want to use gunicorn, cd into api folder then, use ` gunicorn logging_rest_service:app -c gunicorn.config.py` instead of `python api/logging_rest_service.py` + ## Docker Instructions ``` cd rokwire-building-blocks-api @@ -44,7 +44,7 @@ docker build -f loggingservice/Dockerfile -t rokwire/logging-building-block . docker run --name logging --rm --env-file loggingservice/.env -e API_LOC=. -e PRINT_LOG=True -e DEBUG=False -e LOGGING_URL_PREFIX= -p 5000:5000 rokwire/logging-building-block ``` You can edit config.py or environment variable to specify a URL prefix by modifying LOGGIN_URL_PREFIX variable. -If you need to make just /logs as endpoint, put the vaiable value to empty string or do not include this variable. +If you need to make just /logs as endpoint, put the variable value to empty string or do not include this variable. ``` LOGGING_URL_PREFIX="/logs" ``` diff --git a/profileservice/README.md b/profileservice/README.md index db4f60e8..d53b4103 100644 --- a/profileservice/README.md +++ b/profileservice/README.md @@ -77,11 +77,12 @@ The detailed API information is in profile.yaml in the OpenAPI Spec 3.0 format. ``` cd rokwire-building-blocks-api docker build -f profileservice/Dockerfile -t rokwire/profile-building-block . -docker run --name profile --rm --env-file=profileservice/.env -e PROFILE_URL_PREFIX= -e MONGO_PROFILE_URL=mongodb://:27017 -e MONGO_PII_URL=mongodb://:27017 -p 5000:5000 rokwire/profile-building-block +docker run --name profile --rm --env-file=profileservice/.env -e API_LOC=. -e PROFILE_URL_PREFIX= -e MONGO_PROFILE_URL=mongodb://:27017 -e MONGO_PII_URL=mongodb://:27017 -p 5000:5000 rokwire/profile-building-block ``` -You can edit config.py or environment variable to specify a URL prefix by modifying PROFILE_URL_PREFIX variable. -If you need to make just /profiles as endpoint, put the vaiable value to empty string or do not include this variable. - +You can edit config.py or environment variable to specify a URL prefix by modifying PROFILE_ENDPOINT variable. +If you need to make just /profiles as endpoint, put the variable value to empty string or do not include this variable. +There is an optional environment variable named 'API_LOC' for setting api location for connexion. +This should be modified if the docker runs from different location than this instruction. ### AWS ECR Instructions From c02d03854b1494061b05113eeb2a063b492f0eae Mon Sep 17 00:00:00 2001 From: ywkim312 Date: Tue, 4 Aug 2020 16:38:53 -0500 Subject: [PATCH 19/29] Task/523 update auth middleware test README (#527) * added connexion in requirements.txt * modified readme direction Co-authored-by: Sandeep Puthanveetil Satheesan --- CHANGELOG.md | 1 + auth-middleware-test-svc/Dockerfile | 2 +- .../{readme.md => README.md} | 52 ++++++++++++------- auth-middleware-test-svc/docker-compose.yml | 8 --- auth-middleware-test-svc/flaskapp.py | 2 +- auth-middleware-test-svc/requirements.txt | 1 + 6 files changed, 37 insertions(+), 29 deletions(-) rename auth-middleware-test-svc/{readme.md => README.md} (51%) delete mode 100644 auth-middleware-test-svc/docker-compose.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 73a954ef..74556b4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update Authentication Building Block docker base image. [#517](https://github.com/rokwire/rokwire-building-blocks-api/issues/517) - Update Authentication Building Block README [#519](https://github.com/rokwire/rokwire-building-blocks-api/issues/519) - Changed docker base image for Profile and Logging Building Block. [#521](https://github.com/rokwire/rokwire-building-blocks-api/issues/521) +- Changed README for auth-middleware-test-svc based on new change. [#523](https://github.com/rokwire/rokwire-building-blocks-api/issues/523) ### Removed - rokwire.yaml file and deployment scripts that were not getting used. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) diff --git a/auth-middleware-test-svc/Dockerfile b/auth-middleware-test-svc/Dockerfile index 800e45f3..79caebac 100644 --- a/auth-middleware-test-svc/Dockerfile +++ b/auth-middleware-test-svc/Dockerfile @@ -1,6 +1,6 @@ FROM python:3 -LABEL maintainer="fhena2@illinois.edu" +LABEL maintainer="ywkim@illinois.edu" WORKDIR /app COPY auth-middleware-test-svc /app/ diff --git a/auth-middleware-test-svc/readme.md b/auth-middleware-test-svc/README.md similarity index 51% rename from auth-middleware-test-svc/readme.md rename to auth-middleware-test-svc/README.md index 10dad194..7eaded71 100644 --- a/auth-middleware-test-svc/readme.md +++ b/auth-middleware-test-svc/README.md @@ -16,29 +16,43 @@ Pay attention to these things: - [docker build instructions here](#docker-build) - See the readme.md file for the `lib/auth-middleware` python package for environment variables that will need to be set in your building block instance. -## run +## Environment File -- make present-working-directory this one (`rokwire-building-blocks-api/auth-middleware-test-svc/`) -- execute run command - - docker compose - - `$ docker-compose up` - - standard python (need to pip install requirements, and recommend using a virtualenv) - - `$ python flaskapp.py` +You need to have a `.env` file in this directory that contains credentials required for authentication. +Not all of these variables may be required for this test. -## docker build +Example file format: +``` +TWILIO_ACCT_SID= +TWILIO_AUTH_TOKEN= +TWILIO_VERIFY_SERVICE_ID= -## Environment variables -Please add the required environment variables to .env file. This will be imported into the docker container when running docker compose command. +PHONE_VERIFY_SECRET= +PHONE_VERIFY_AUDIENCE= -### std docker +SHIBBOLETH_HOST= +SHIBBOLETH_CLIENT_ID= +``` -- make present-working-directory the parent directory - - eg. - - this project = `rokwire-building-blocks-api/auth-middleware-test-svc` - - parent directory = `rokwire-building-blocks-api` - build context -- `$ docker build -f auth-middleware-test-svc/Dockerfile .` +## Run application -### docker compose +### Run locally without Docker +``` +cd rokwire-building-blocks-api/auth-middleware-test-svc +virtualenv -p python3 venv +source venv/bin/activate +pip install -r requirements.txt +python flaskapp.py` +``` -- make present-working-directory this one (`rokwire-building-blocks-api/auth-middleware-test-svc/`) -- `$ docker-compose build` +If you want to use gunicorn, cd into api folder then, use ` gunicorn flaskapp:app -c gunicorn.config.py` instead of `python flaskapp.py` + +It should be running at http://localhost:5000 + +### Docker Instructions + +``` +cd rokwire-building-blocks-api +docker build -t rokwire/auth_middleware_test -f auth-middleware-test-svc/Dockerfile . +docker run --rm --env-file=auth-middleware-test-svc/.env -p 5000:5000 rokwire/auth_middleware_test +``` diff --git a/auth-middleware-test-svc/docker-compose.yml b/auth-middleware-test-svc/docker-compose.yml deleted file mode 100644 index b5893c52..00000000 --- a/auth-middleware-test-svc/docker-compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: '3' -services: - web: - build: - context: ../ - dockerfile: auth-middleware-test-svc/Dockerfile - ports: ["5000:5000"] - env_file: .env diff --git a/auth-middleware-test-svc/flaskapp.py b/auth-middleware-test-svc/flaskapp.py index 62c1372a..13516db8 100644 --- a/auth-middleware-test-svc/flaskapp.py +++ b/auth-middleware-test-svc/flaskapp.py @@ -20,7 +20,7 @@ ################################################ # Call middleware here! -# ⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ +################################################ app.before_request(auth_middleware.authenticate) diff --git a/auth-middleware-test-svc/requirements.txt b/auth-middleware-test-svc/requirements.txt index 22d0e072..593dbf0a 100644 --- a/auth-middleware-test-svc/requirements.txt +++ b/auth-middleware-test-svc/requirements.txt @@ -1,4 +1,5 @@ Flask==1.1.1 gunicorn==19.9.0 +connexion[swagger-ui]==2.4.0 ../lib/auth-middleware From 6e22c48cb20504e35bf08bf21e0e8ec26d4fc039 Mon Sep 17 00:00:00 2001 From: "David D. Riddle" Date: Tue, 4 Aug 2020 16:53:51 -0500 Subject: [PATCH 20/29] Add Yelp's Secret Detector (#512) * Add Yelp's Secret Detector * Update CHANGELOG.md --- .github/workflows/detect-secrets.yaml | 20 +++ .pre-commit-config.yaml | 6 + .secrets.baseline | 182 ++++++++++++++++++++++++++ CHANGELOG.md | 3 + README.md | 9 ++ 5 files changed, 220 insertions(+) create mode 100644 .github/workflows/detect-secrets.yaml create mode 100644 .pre-commit-config.yaml create mode 100644 .secrets.baseline diff --git a/.github/workflows/detect-secrets.yaml b/.github/workflows/detect-secrets.yaml new file mode 100644 index 00000000..b52b8434 --- /dev/null +++ b/.github/workflows/detect-secrets.yaml @@ -0,0 +1,20 @@ +name: Detect Secrets + +on: [push, pull_request] + +jobs: + detect-secrets: + runs-on: ubuntu-latest + container: python:latest + + steps: + - uses: actions/checkout@v2 + + - name: Install Yelp's detect secrets + run: | + apt-get update && apt-get install -y jq + pip install yq + pip install detect-secrets==$(yq -r .[0].rev .pre-commit-config.yaml) + + - name: Detect potential secrets + run: find -type f -not -path './.git/*' -printf '%P\n' | xargs detect-secrets-hook --baseline .secrets.baseline diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..b2d0be4b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +- repo: git@github.com:Yelp/detect-secrets + rev: v0.14.1 + hooks: + - id: detect-secrets + args: ['--baseline', '.secrets.baseline'] + exclude: .*/tests/.* diff --git a/.secrets.baseline b/.secrets.baseline new file mode 100644 index 00000000..9bd8890e --- /dev/null +++ b/.secrets.baseline @@ -0,0 +1,182 @@ +{ + "custom_plugin_paths": [], + "exclude": { + "files": null, + "lines": null + }, + "generated_at": "2020-08-04T19:06:02Z", + "plugins_used": [ + { + "name": "AWSKeyDetector" + }, + { + "name": "ArtifactoryDetector" + }, + { + "base64_limit": 4.5, + "name": "Base64HighEntropyString" + }, + { + "name": "BasicAuthDetector" + }, + { + "name": "CloudantDetector" + }, + { + "hex_limit": 3, + "name": "HexHighEntropyString" + }, + { + "name": "IbmCloudIamDetector" + }, + { + "name": "IbmCosHmacDetector" + }, + { + "name": "JwtTokenDetector" + }, + { + "keyword_exclude": null, + "name": "KeywordDetector" + }, + { + "name": "MailchimpDetector" + }, + { + "name": "PrivateKeyDetector" + }, + { + "name": "SlackDetector" + }, + { + "name": "SoftlayerDetector" + }, + { + "name": "StripeDetector" + }, + { + "name": "TwilioKeyDetector" + } + ], + "results": { + "appconfigservice/README.md": [ + { + "hashed_secret": "0dd91d7d2dee491919369a6d60e20954ba22ea7c", + "is_secret": false, + "is_verified": false, + "line_number": 22, + "type": "Secret Keyword" + }, + { + "hashed_secret": "81b127e2222d9bfc4609053faec85300f7525463", + "is_secret": false, + "is_verified": false, + "line_number": 28, + "type": "Secret Keyword" + }, + { + "hashed_secret": "a91dbe46987cdf705256b5833997728c9add55f6", + "is_secret": false, + "is_verified": false, + "line_number": 52, + "type": "Secret Keyword" + } + ], + "appconfigservice/appconfig-v010.json": [ + { + "hashed_secret": "a523e602e6a14449f8a8c3a4a2a2d00525eeb556", + "is_secret": false, + "is_verified": false, + "line_number": 20, + "type": "Basic Auth Credentials" + } + ], + "appconfigservice/appconfig-v094.json": [ + { + "hashed_secret": "a523e602e6a14449f8a8c3a4a2a2d00525eeb556", + "is_secret": false, + "is_verified": false, + "line_number": 27, + "type": "Basic Auth Credentials" + } + ], + "appconfigservice/appconfig.yaml": [ + { + "hashed_secret": "a45a360e6ff9bceaf3fcfef370a6d6e1d4ba9271", + "is_secret": false, + "is_verified": false, + "line_number": 65, + "type": "Hex High Entropy String" + } + ], + "authservice/README.md": [ + { + "hashed_secret": "81b127e2222d9bfc4609053faec85300f7525463", + "is_secret": false, + "is_verified": false, + "line_number": 73, + "type": "Secret Keyword" + } + ], + "eventservice/README.md": [ + { + "hashed_secret": "81b127e2222d9bfc4609053faec85300f7525463", + "is_secret": false, + "is_verified": false, + "line_number": 24, + "type": "Secret Keyword" + }, + { + "hashed_secret": "289a8d69fc17eb0668911e4a2c2f43f409c1b6e0", + "is_secret": false, + "is_verified": false, + "line_number": 30, + "type": "Secret Keyword" + } + ], + "loggingservice/README.md": [ + { + "hashed_secret": "81b127e2222d9bfc4609053faec85300f7525463", + "is_secret": false, + "is_verified": false, + "line_number": 22, + "type": "Secret Keyword" + }, + { + "hashed_secret": "289a8d69fc17eb0668911e4a2c2f43f409c1b6e0", + "is_secret": false, + "is_verified": false, + "line_number": 28, + "type": "Secret Keyword" + } + ], + "profileservice/README.md": [ + { + "hashed_secret": "0dd91d7d2dee491919369a6d60e20954ba22ea7c", + "is_secret": false, + "is_verified": false, + "line_number": 38, + "type": "Secret Keyword" + }, + { + "hashed_secret": "81b127e2222d9bfc4609053faec85300f7525463", + "is_secret": false, + "is_verified": false, + "line_number": 44, + "type": "Secret Keyword" + }, + { + "hashed_secret": "289a8d69fc17eb0668911e4a2c2f43f409c1b6e0", + "is_secret": false, + "is_verified": false, + "line_number": 50, + "type": "Secret Keyword" + } + ] + }, + "version": "0.14.1", + "word_list": { + "file": null, + "hash": null + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 74556b4f..2c026907 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Docker image vulnerabilities in Authentication Building Block. [#499](https://github.com/rokwire/rokwire-building-blocks-api/issues/499) - Docker image vulnerabilities in Events Building Block. [#484](https://github.com/rokwire/rokwire-building-blocks-api/issues/484) +### Security +- Add Yelp's Secret Detector [#530](https://github.com/rokwire/rokwire-building-blocks-api/issues/530) + ## [1.6.0] - 2020-07-14 - Add Health Building Block APIs documentation. [#468](https://github.com/rokwire/rokwire-building-blocks-api/issues/468) - Code of Conduct. [#487](https://github.com/rokwire/rokwire-building-blocks-api/issues/487) diff --git a/README.md b/README.md index c1de7912..f21772c7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,15 @@ +![Detect Secrets](https://github.com/rokwire/rokwire-building-blocks-api/workflows/Detect%20Secrets/badge.svg) + # Rokwire Platform Building Blocks API Documentation API definitions of the Rokwire Platform building blocks +## Install commit hooks + +``` +$ pip install detect-secrets pre-commit +$ pre-commit install +``` + ## Setup and Run - Create the Rokwire Platform API Doc Docker image and run the Docker container: From 0b136988b03f19c95100e71c1262c041f7da9008 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Wed, 5 Aug 2020 13:16:44 -0500 Subject: [PATCH 21/29] Update secret baseline file. (#533) --- .secrets.baseline | 11 ++++++++++- CHANGELOG.md | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.secrets.baseline b/.secrets.baseline index 9bd8890e..886afc9a 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -4,7 +4,7 @@ "files": null, "lines": null }, - "generated_at": "2020-08-04T19:06:02Z", + "generated_at": "2020-08-05T02:59:28Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -109,6 +109,15 @@ "type": "Hex High Entropy String" } ], + "auth-middleware-test-svc/README.md": [ + { + "hashed_secret": "0dd91d7d2dee491919369a6d60e20954ba22ea7c", + "is_secret": false, + "is_verified": false, + "line_number": 30, + "type": "Secret Keyword" + } + ], "authservice/README.md": [ { "hashed_secret": "81b127e2222d9bfc4609053faec85300f7525463", diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c026907..15b2bdd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security - Add Yelp's Secret Detector [#530](https://github.com/rokwire/rokwire-building-blocks-api/issues/530) +- Update secret baseline file [#532](https://github.com/rokwire/rokwire-building-blocks-api/issues/532) ## [1.6.0] - 2020-07-14 - Add Health Building Block APIs documentation. [#468](https://github.com/rokwire/rokwire-building-blocks-api/issues/468) From 4be71e7bd33be9a188790e70c51a4be68955adb5 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Thu, 13 Aug 2020 15:56:26 -0500 Subject: [PATCH 22/29] Ignore .env files when building docker images. (#534) --- .dockerignore | 2 +- CHANGELOG.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 4c49bd78..934c1fb2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1 @@ -.env +*/.env diff --git a/CHANGELOG.md b/CHANGELOG.md index 15b2bdd6..cd079065 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Docker image vulnerabilities in Authentication Building Block. [#499](https://github.com/rokwire/rokwire-building-blocks-api/issues/499) - Docker image vulnerabilities in Events Building Block. [#484](https://github.com/rokwire/rokwire-building-blocks-api/issues/484) +- Re-fixed bug related to including .env files in docker images. [#419](https://github.com/rokwire/rokwire-building-blocks-api/issues/419) ### Security - Add Yelp's Secret Detector [#530](https://github.com/rokwire/rokwire-building-blocks-api/issues/530) From 376490262f47db39de2d16648963acbdb53ece47 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Thu, 13 Aug 2020 18:26:37 -0500 Subject: [PATCH 23/29] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 4 ++-- .github/ISSUE_TEMPLATE/feature_request.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea78..5b0a8043 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,8 +1,8 @@ --- name: Bug report about: Create a report to help us improve -title: '' -labels: '' +title: "[BUG]" +labels: bug assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7d..f4558654 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,8 +1,8 @@ --- name: Feature request about: Suggest an idea for this project -title: '' -labels: '' +title: "[FEATURE]" +labels: enhancement assignees: '' --- From e6952073b52b29406ac3a3e5b15995e507013241 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Sat, 15 Aug 2020 17:21:16 -0500 Subject: [PATCH 24/29] Update issue template (#538) * Update issue template * Update rokwire-issue-template.md * Update CHANGELOG.md --- .github/ISSUE_TEMPLATE/rokwire-issue-template.md | 4 ++-- CHANGELOG.md | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/rokwire-issue-template.md b/.github/ISSUE_TEMPLATE/rokwire-issue-template.md index ea45639b..5f8a4861 100644 --- a/.github/ISSUE_TEMPLATE/rokwire-issue-template.md +++ b/.github/ISSUE_TEMPLATE/rokwire-issue-template.md @@ -1,7 +1,7 @@ --- name: Rokwire Issue Template -about: This is a generic issue template for Rokwire. -title: "[TASK] | [FEATURE] | [BUG] | [HOTFIX] | [EPIC]" +about: A generic Rokwire issue template for creating tasks and epics. +title: "[TASK] | [EPIC] " labels: '' assignees: '' diff --git a/CHANGELOG.md b/CHANGELOG.md index cd079065..7200b90d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update Authentication Building Block README [#519](https://github.com/rokwire/rokwire-building-blocks-api/issues/519) - Changed docker base image for Profile and Logging Building Block. [#521](https://github.com/rokwire/rokwire-building-blocks-api/issues/521) - Changed README for auth-middleware-test-svc based on new change. [#523](https://github.com/rokwire/rokwire-building-blocks-api/issues/523) +- Update issue template. [#537](https://github.com/rokwire/rokwire-building-blocks-api/issues/537) ### Removed - rokwire.yaml file and deployment scripts that were not getting used. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) From 3653ae32f4538f82513bb153ff36d648767428a9 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Sat, 15 Aug 2020 17:36:02 -0500 Subject: [PATCH 25/29] Update README. (#540) --- CHANGELOG.md | 1 + README.md | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7200b90d..b9b5ff9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Changed docker base image for Profile and Logging Building Block. [#521](https://github.com/rokwire/rokwire-building-blocks-api/issues/521) - Changed README for auth-middleware-test-svc based on new change. [#523](https://github.com/rokwire/rokwire-building-blocks-api/issues/523) - Update issue template. [#537](https://github.com/rokwire/rokwire-building-blocks-api/issues/537) +- Update README. [#539](https://github.com/rokwire/rokwire-building-blocks-api/issues/539) ### Removed - rokwire.yaml file and deployment scripts that were not getting used. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) diff --git a/README.md b/README.md index f21772c7..ebe4fd82 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,21 @@ docker build -t rokwire/api-doc . docker tag rokwire/api-doc:latest 779619664536.dkr.ecr.us-east-2.amazonaws.com/rokwire/api-doc:latest docker push 779619664536.dkr.ecr.us-east-2.amazonaws.com/rokwire/api-doc:latest ``` + +# Other Modules in this Repository + +- [App Config Building Block](https://github.com/rokwire/rokwire-building-blocks-api/tree/develop/appconfigservice) + - Python Connexion-based RESTful web services for managing client application configurations. +- [Authentication Building Block](https://github.com/rokwire/rokwire-building-blocks-api/tree/develop/authservice) + - Python Connexion-based RESTful web services for managing user authentication. Currently, this module provides API endpoints for phone-based user verification. +- [Auth Middleware Library](https://github.com/rokwire/rokwire-building-blocks-api/tree/develop/lib/auth-middleware) + - Python Library that provides methods for managing authentication and authorization of incoming requests. +- [Events Building Block](https://github.com/rokwire/rokwire-building-blocks-api/tree/develop/eventservice) + - Python Connexion-based RESTful web services for managing events. +- [Example Building Block](https://github.com/rokwire/rokwire-building-blocks-api/tree/develop/auth-middleware-test-svc) + - An example building block that uses the Auth Middleware Library. +- [Logging Building Block](https://github.com/rokwire/rokwire-building-blocks-api/tree/develop/loggingservice) + - Python Connexion-based RESTful web services for managing logs. +- [Profile Building Block](https://github.com/rokwire/rokwire-building-blocks-api/tree/develop/profileservice) + - Python Connexion-based RESTful web services for managing user profiles. + \ No newline at end of file From 89e721ec622206448336f90ae42fd16f7a418802 Mon Sep 17 00:00:00 2001 From: Bing Zhang Date: Wed, 2 Sep 2020 13:24:53 -0500 Subject: [PATCH 26/29] add isvirtual and displayOnlyWithSuperEvent to events schema (#544) --- CHANGELOG.md | 1 + eventservice/events.yaml | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9b5ff9f..8b09c074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Add flags isVirtual and displayOnlyWithSuperEvent to events schema. [#542, #541](https://github.com/rokwire/rokwire-building-blocks-api/issues/542, https://github.com/rokwire/rokwire-building-blocks-api/issues/541) - Add Standard License Header for Events Building Block. [#480](https://github.com/rokwire/rokwire-building-blocks-api/issues/480) - Add Standard License Header for Authentication Building Block [#497](https://github.com/rokwire/rokwire-building-blocks-api/issues/497) - Add Standard License Header for Authentication Library. [#498](https://github.com/rokwire/rokwire-building-blocks-api/issues/498) diff --git a/eventservice/events.yaml b/eventservice/events.yaml index b258bb01..19ef37c0 100755 --- a/eventservice/events.yaml +++ b/eventservice/events.yaml @@ -762,6 +762,12 @@ components: description: A list of objects containg some basic details about the sub events that are part of a super event. This property currently applies only to a super event. I.e. this assumes that `isSuperEvent` is set to `true`. items: $ref: "#/components/schemas/SubEventDetails" + displayOnlyWithSuperEvent: + type: boolean + description: If this flag is set to true, the app client will then display the event only under a super events screen. + isVirtual: + type: boolean + description: Setting this to true will indicate that the event is virtual. This flag can then be used to ignore geocoding calculation or displaying a physical location in the app. SubEventDetails: type: object properties: From f0714c9a03309104cb14ff24bb6da0910b3e79cd Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Thu, 3 Sep 2020 09:49:34 -0500 Subject: [PATCH 27/29] Update CHANGELOG.md --- CHANGELOG.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b09c074..846f53ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,15 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [1.7.0] - 2020-09-03 ### Added -- Add flags isVirtual and displayOnlyWithSuperEvent to events schema. [#542, #541](https://github.com/rokwire/rokwire-building-blocks-api/issues/542, https://github.com/rokwire/rokwire-building-blocks-api/issues/541) - Add Standard License Header for Events Building Block. [#480](https://github.com/rokwire/rokwire-building-blocks-api/issues/480) -- Add Standard License Header for Authentication Building Block [#497](https://github.com/rokwire/rokwire-building-blocks-api/issues/497) +- Add Standard License Header for Authentication Building Block. [#497](https://github.com/rokwire/rokwire-building-blocks-api/issues/497) - Add Standard License Header for Authentication Library. [#498](https://github.com/rokwire/rokwire-building-blocks-api/issues/498) - Add CODEOWNERS file. [#508](https://github.com/rokwire/rokwire-building-blocks-api/issues/508) - Add Standard License Header for API Doc. [#501](https://github.com/rokwire/rokwire-building-blocks-api/issues/501) - Add bug report and feature request issue templates. [#510](https://github.com/rokwire/rokwire-building-blocks-api/issues/510) - Add Talent Chooser Building Block APIs documentation. [#528](https://github.com/rokwire/rokwire-building-blocks-api/issues/528) +- Add flags isVirtual and displayOnlyWithSuperEvent to events schema. [#542](https://github.com/rokwire/rokwire-building-blocks-api/issues/542), [#541](https://github.com/rokwire/rokwire-building-blocks-api/issues/541) ### Changed - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) @@ -21,7 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Rokwire API Doc Dockerfile to integrate multiple OpenAPI specifications file. [#486](https://github.com/rokwire/rokwire-building-blocks-api/issues/486) - Update Appconfig Building Block docker base image. [#515](https://github.com/rokwire/rokwire-building-blocks-api/issues/515) - Update Authentication Building Block docker base image. [#517](https://github.com/rokwire/rokwire-building-blocks-api/issues/517) -- Update Authentication Building Block README [#519](https://github.com/rokwire/rokwire-building-blocks-api/issues/519) +- Update Authentication Building Block README. [#519](https://github.com/rokwire/rokwire-building-blocks-api/issues/519) - Changed docker base image for Profile and Logging Building Block. [#521](https://github.com/rokwire/rokwire-building-blocks-api/issues/521) - Changed README for auth-middleware-test-svc based on new change. [#523](https://github.com/rokwire/rokwire-building-blocks-api/issues/523) - Update issue template. [#537](https://github.com/rokwire/rokwire-building-blocks-api/issues/537) @@ -36,8 +38,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Re-fixed bug related to including .env files in docker images. [#419](https://github.com/rokwire/rokwire-building-blocks-api/issues/419) ### Security -- Add Yelp's Secret Detector [#530](https://github.com/rokwire/rokwire-building-blocks-api/issues/530) -- Update secret baseline file [#532](https://github.com/rokwire/rokwire-building-blocks-api/issues/532) +- Add Yelp's Secret Detector. [#530](https://github.com/rokwire/rokwire-building-blocks-api/issues/530) +- Update secret baseline file. [#532](https://github.com/rokwire/rokwire-building-blocks-api/issues/532) ## [1.6.0] - 2020-07-14 - Add Health Building Block APIs documentation. [#468](https://github.com/rokwire/rokwire-building-blocks-api/issues/468) @@ -252,7 +254,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - References to AWS keys and variables in the Events Building Block. -[Unreleased]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.6.0...HEAD +[Unreleased]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.7.0...HEAD +[1.7.0]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.6.0...1.7.0 [1.6.0]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.5.0...1.6.0 [1.5.0]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.4.0...1.5.0 [1.4.0]: https://github.com/rokwire/rokwire-building-blocks-api/compare/1.3.1...1.4.0 From b02dda48b1c816d14fa8fc453e0172b03da19693 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Thu, 3 Sep 2020 09:56:34 -0500 Subject: [PATCH 28/29] Update version numbers in the OpenAPI documents. --- appconfigservice/appconfig.yaml | 2 +- authservice/auth.yaml | 2 +- eventservice/events.yaml | 2 +- loggingservice/logging.yaml | 2 +- profileservice/profile.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/appconfigservice/appconfig.yaml b/appconfigservice/appconfig.yaml index f4fe84ea..282ba3d6 100755 --- a/appconfigservice/appconfig.yaml +++ b/appconfigservice/appconfig.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: Rokwire App Config Building Block API description: App Config Building Block API Documentation - version: 1.5.0 + version: 1.7.0 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/authservice/auth.yaml b/authservice/auth.yaml index 8a7149a2..48110ae8 100644 --- a/authservice/auth.yaml +++ b/authservice/auth.yaml @@ -2,7 +2,7 @@ openapi: 3.0.2 info: title: Rokwire Auth Building Block API description: Authentication Building Block API Documentation - version: "1.5.0" + version: "1.7.0" paths: /authentication/phone-initiate: post: diff --git a/eventservice/events.yaml b/eventservice/events.yaml index 19ef37c0..6f1b9bf3 100755 --- a/eventservice/events.yaml +++ b/eventservice/events.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: Rokwire Events Building Block API description: Events Building Block API Documentation - version: 1.5.0 + version: 1.7.0 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/loggingservice/logging.yaml b/loggingservice/logging.yaml index 36d72cc7..298cba90 100755 --- a/loggingservice/logging.yaml +++ b/loggingservice/logging.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: Rokwire Logging Building Block API description: Logging Building Block API Documentation - version: 1.5.0 + version: 1.7.0 servers: - url: https://api.rokwire.illinois.edu description: Production server diff --git a/profileservice/profile.yaml b/profileservice/profile.yaml index d0fdc945..4c238921 100755 --- a/profileservice/profile.yaml +++ b/profileservice/profile.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: Rokwire Profile Building Block API description: Profile Building Block API Documentation - version: 1.5.0 + version: 1.7.0 servers: - url: https://api.rokwire.illinois.edu description: Production server From 192bdb0ccd58ba3132ecacfaeb10105f52e919d4 Mon Sep 17 00:00:00 2001 From: Sandeep Puthanveetil Satheesan Date: Thu, 3 Sep 2020 15:59:33 -0500 Subject: [PATCH 29/29] Add startDateLimit query parameter to events search endpoint. (#547) --- CHANGELOG.md | 1 + eventservice/README.md | 5 +++++ eventservice/api/utils/query_params.py | 9 +++++++++ eventservice/events.yaml | 8 ++++++++ 4 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b09c074..436057c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add Standard License Header for API Doc. [#501](https://github.com/rokwire/rokwire-building-blocks-api/issues/501) - Add bug report and feature request issue templates. [#510](https://github.com/rokwire/rokwire-building-blocks-api/issues/510) - Add Talent Chooser Building Block APIs documentation. [#528](https://github.com/rokwire/rokwire-building-blocks-api/issues/528) +- Add `startDateLimit` query parameter to events search endpoint. [#545](https://github.com/rokwire/rokwire-building-blocks-api/issues/545) ### Changed - OpenAPI specification file rokwire.yaml file split across different building blocks. [#485](https://github.com/rokwire/rokwire-building-blocks-api/issues/485) diff --git a/eventservice/README.md b/eventservice/README.md index aff04eb9..0c7287a5 100644 --- a/eventservice/README.md +++ b/eventservice/README.md @@ -281,6 +281,11 @@ This query will return back all events whose startdate and enddate between the r /events?startDate=2019-04-25T13:00:00&endDate=2019-04-25T17:00:00 ``` +This query will return back all events whose startDate is between the provided range, including both the dates. This kind of query can be used to find events whose start date falls within a given date range. +``` +/events?startDate=2019-04-20T00:00:00&startDateLimit=2019-04-25T23:59:59 +``` + ### Geolocation Radius Search This query will return back all events whose geolocation is within ``800`` meter centered at given geolocation point. diff --git a/eventservice/api/utils/query_params.py b/eventservice/api/utils/query_params.py index 382deba2..4dbf5d76 100644 --- a/eventservice/api/utils/query_params.py +++ b/eventservice/api/utils/query_params.py @@ -82,6 +82,15 @@ def format_query(args, query): microsecond=0 ) query_parts.append({'startDate': {'$gte': value}}) + if args.get('startDateLimit'): + value = datetime.datetime.strptime(args.get('startDateLimit'), "%Y-%m-%dT%H:%M:%S") + # Clamp values to the previous lowest 15min. + value = value.replace( + minute=(value.minute - (value.minute % 15)), + second=0, + microsecond=0 + ) + query_parts.append({'startDate': {'$lte': value}}) if args.get('endDate'): value = datetime.datetime.strptime(args.get('endDate'), "%Y-%m-%dT%H:%M:%S") # Clamp values to the next highest 15min. This uses timedelta in case the diff --git a/eventservice/events.yaml b/eventservice/events.yaml index 19ef37c0..a152779e 100755 --- a/eventservice/events.yaml +++ b/eventservice/events.yaml @@ -66,6 +66,14 @@ paths: explode: true schema: type: string + - name: startDateLimit + in: query + description: Another parameter for searching events based on a given start date, e.g., /events?startDateLimit=2019-04-25T13:00:00. This query will return all events whose start date is less than or equal to the given input date. + required: false + style: form + explode: true + schema: + type: string - name: endDate in: query description: The parameter for searching events based on a given end date, e.g., /events?endDate=2019-04-25T13:00:00. This query will return all events whose start date is equal or before the given input date.