Skip to content

Commit

Permalink
Release (#28)
Browse files Browse the repository at this point in the history
* Fix develop dockerfile

* Change keycloak urls

* Fix develop workflow tag

* Fix production workflow

* Change log message

* Change config

* Add health check

* Fix health check

* Add ready health endpoint

* Fix issue

* Change workflow filenames

* Eoepca 910 um keycloak develop an identity api based on keycloak api (#17)

* feat: policies endpoints added, not completely

* feat: working on update policies

* feat: all remaining added, still policy update not working, create and update scope based permission not working

* feat: last resource permissions endpoints added and working

* fix: changed pyyaml version from 5.4.1 to 5.3.1

* feat: endpoints changed

* Update README

* Update config

* Update config

* Update config

* Api testing (#18)

* feat: added client_id as param to enpoints and other fixes

* added changes for permissions endpoints

* Update ci

* Update ci

* Release v1.0.0

* Fix ci

* Fix requirements

* Fix ci

* Upgrade flask version

* Update requirements

* feat: added error handling (#23)

* feat: added validator of register and protect resource enpoint to test

* feat: register and protect resources endpoint working

* feat: added delete resources, policies and permissions

* Update ci

* Update ci

* Fix ci

* Add options method to endpoints

* feat: added endpoint to create client, add resources and protect them if provided

* Revert "Add options method to endpoints"

This reverts commit 9d8c034.

* fea: commit fixes

* feat: more fixes, some endpoint were dounbled

* fix: last fix

* Update ci

* fix: policies fix, response now return client id and resources created

* feat: create client default to confidential and authorization enabled

* Convert to FastAPI

* Convert to FastAPI

* changes to models

* Remove file

* Add error handling, pydantic models, files restructuring

* Fix issues

* Handle keycloak error message

* added fildes to models and descriptions

* Add authenticated field

* Clean and reformat

* Point to keycloak client 1.0.0

* Change logging

* Fix readme

* Clean

* Change logging

* Clean

---------

Co-authored-by: flaviorosadme <[email protected]>
Co-authored-by: flaviorosadme <[email protected]>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent bf2a34a commit 620a77b
Show file tree
Hide file tree
Showing 62 changed files with 930 additions and 2,614 deletions.
6 changes: 3 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*
!src
!conf
!app
!requirements.*
!.flaskenv
!config.ini
!logging.yaml
3 changes: 0 additions & 3 deletions .flaskenv

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ env/
.vscode

.idea
postgres
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

18 changes: 7 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
FROM python:alpine
RUN apk add --no-cache git
RUN mkdir /app
WORKDIR /app
COPY . .
ENV FLASK_APP "src/app:create_app()"
ENV FLASK_ENV local
ENV FLASK_DEBUG 1
RUN pip install -r requirements.txt
EXPOSE 5566
CMD [ "python", "-m" , "flask", "run", "--host=0.0.0.0", "--port=5566"]
FROM python:3.12
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY ./config.ini /code/config.ini
COPY ./app /code/app
CMD ["uvicorn", "app.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "8080"]
120 changes: 51 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
<!-- PROJECT SHIELDS -->
<!--
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->

[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
![Build][build-shield]

<!-- PROJECT LOGO -->
<br />
<p align="center">
<a href="https://github.com/EOEPCA/um-identity-api">
<img src="images/logo.png" alt="Logo" width="80" height="80">
</a>

<h3 align="center">Identity API</h3>

<p align="center">
Flask application to enable a REST API server to manage Keycloak through Keycloak Admin API (https://www.keycloak.org/docs-api/21.0.1/rest-api/index.html) and Protection API (https://www.keycloak.org/docs/latest/authorization_services/index.html#_service_protection_api).
FastAPI application exposing a Restful API to manage Keycloak through Keycloak Admin API (https://www.keycloak.org/docs-api/22.0.1/rest-api/index.html) and Protection API (https://www.keycloak.org/docs/latest/authorization_services/index.html#_service_protection_api).
<br />
<a href="https://github.com/EOEPCA/um-identity-api"><strong>Explore the docs »</strong></a>
<br />
<a href="https://github.com/EOEPCA/um-identity-api">View Demo</a>
·
<a href="https://github.com/EOEPCA/um-identity-api/issues">Report Bug</a>
·
<a href="https://github.com/EOEPCA/um-identity-api/issues">Request Feature</a>
</p>
</p>

## Table of Contents
Expand All @@ -42,120 +29,105 @@
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Testing](#testing)
- [Documentation](#documentation)
- [Usage](#usage)
- [Running the template service](#running-the-template-service)
- [Upgrading Gradle Wrapper](#upgrading-gradle-wrapper)
- [Roadmap](#roadmap)
- [Contributing](#contributing)
- [License](#license)
- [Contact](#contact)
- [Acknowledgements](#acknowledgements)

<!-- ABOUT THE PROJECT -->

## About The Project

Flask application to enable a REST API server to manage Keycloak through Keycloak Admin API (https://www.keycloak.org/docs-api/21.0.1/rest-api/index.html) and Protection API (https://www.keycloak.org/docs/latest/authorization_services/index.html#_service_protection_api).
FastAPI application exposing a Restful API to manage Keycloak through Keycloak Admin
API (https://www.keycloak.org/docs-api/21.0.1/rest-api/index.html) and Protection
API (https://www.keycloak.org/docs/latest/authorization_services/index.html#_service_protection_api).

Includes three main paths:
- **Resources** - CRUD operations to manage resources
- **Policies** - CRUD operations to manage policies
- **Permissions** - CRUD operations to manage permissions
Swagger docs are available at /docs.
Redoc docs are available at /redoc.

### Built With

- [Python](https://www.python.org//)
- [PyTest](https://docs.pytest.org)
- [YAML](https://yaml.org/)
- [Travis CI](https://travis-ci.com/)

<!-- GETTING STARTED -->
- [Python](https://www.python.org)
- [FastAPI](https://fastapi.tiangolo.com)

## Getting Started

To get a local copy up and running follow these simple steps.

### Prerequisites

This is an example of how to list things you need to use the software and how to install them.

- [Docker](https://www.docker.com/)
- [Python](https://www.python.org//)
- [Docker](https://www.docker.com)
or
- [Docker compose](https://docs.docker.com/compose)
or
- [Python](https://www.python.org)

### Installation

1. Get into EOEPCA's development environment

```sh
vagrant ssh
```

3. Clone the repo
1. Clone the repo

```sh
git clone https://github.com/EOEPCA/um-identity-api
```

4. Change local directory
2. Change local directory

```sh
cd um-identity-api
```

5. Execute
3. Execute

5.1 Run locally with Python
3.1 Run with docker compose
```sh
docker compose up -d --build
```
3.2 Run with Python
```sh
pip install -r requirements.txt
python -m "flask" run --host=0.0.0.0 --port=5566
uvicorn app.main:app
```
5.2 Run locally with Docker
3.3 Run with Docker
```sh
docker build . --progress=plain -t um-identity-api:develop
docker run --rm -dp 5566:5566 --name um-identity-api um-identity-api:develop
docker build . --progress=plain -t um-identity-api:local
docker run --rm -dp 8080:8080 --name um-identity-api um-identity-api:local
```
5.3 Run develop branch with Docker
3.4 Run develop branch with Docker
```sh
docker run --rm -dp 5566:5566 --name um-identity-api ghcr.io/eoepca/um-identity-api:develop
docker run --rm -dp 8080:8080 --name um-identity-api ghcr.io/eoepca/um-identity-api:develop
```
5.4 Run master branch with Docker
3.5 Run master branch with Docker
```sh
docker run --rm -dp 5566:5566 --name um-identity-api ghcr.io/eoepca/um-identity-api:production
docker run --rm -dp 8080:8080 --name um-identity-api ghcr.io/eoepca/um-identity-api:production
```

## Documentation

The component documentation can be found at https://eoepca.github.io/um-identity-api/.

<!-- USAGE EXAMPLES -->

## Usage

Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.

_For more examples, please refer to the [Documentation](https://example.com)_

<!-- ROADMAP -->
Check Redoc page to try out the API, available at http://localhost:8080/redoc

## Roadmap

See the [open issues](https://github.com/EOEPCA/um-identity-api/issues) for a list of proposed features (and known issues).

<!-- CONTRIBUTING -->
See the [open issues](https://github.com/EOEPCA/um-identity-api/issues) for a list of proposed features (and known
issues).

## Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any
contributions you make are **greatly appreciated**.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

<!-- LICENSE -->

## License

Expand All @@ -169,17 +141,27 @@ Project Link: [https://github.com/EOEPCA/um-identity-api](https://github.com/EOE

## Acknowledgements

- README.md is based on [this template](https://github.com/othneildrew/Best-README-Template) by [Othneil Drew](https://github.com/othneildrew).
- README.md is based on [this template](https://github.com/othneildrew/Best-README-Template)
by [Othneil Drew](https://github.com/othneildrew).

[contributors-shield]: https://img.shields.io/github/contributors/EOEPCA/um-identity-api.svg?style=flat-square

[contributors-shield]: https://img.shields.io/github/contributors/EOEPCA/um-identity-apisvg?style=flat-square
[contributors-url]: https://github.com/EOEPCA/um-identity-api/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/EOEPCA/um-identity-apisvg?style=flat-square

[forks-shield]: https://img.shields.io/github/forks/EOEPCA/um-identity-api.svg?style=flat-square

[forks-url]: https://github.com/EOEPCA/um-identity-api/network/members
[stars-shield]: https://img.shields.io/github/stars/EOEPCA/um-identity-apisvg?style=flat-square

[stars-shield]: https://img.shields.io/github/stars/EOEPCA/um-identity-api.svg?style=flat-square

[stars-url]: https://github.com/EOEPCA/um-identity-api/stargazers
[issues-shield]: https://img.shields.io/github/issues/EOEPCA/um-identity-apisvg?style=flat-square

[issues-shield]: https://img.shields.io/github/issues/EOEPCA/um-identity-api.svg?style=flat-square

[issues-url]: https://github.com/EOEPCA/um-identity-api/issues
[license-shield]: https://img.shields.io/github/license/EOEPCA/um-identity-apisvg?style=flat-square

[license-shield]: https://img.shields.io/github/license/EOEPCA/um-identity-api.svg?style=flat-square

[license-url]: https://github.com/EOEPCA/um-identity-api/blob/master/LICENSE
[build-shield]: https://www.travis-ci.com/EOEPCA/um-identity-apisvg?branch=master

[build-shield]: https://www.travis-ci.com/EOEPCA/um-identity-api.svg?branch=master
Empty file added app/__init __.py
Empty file.
8 changes: 8 additions & 0 deletions app/configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import os
from typing import Mapping

from identityutils.configuration import load_configuration

config: Mapping[str, str] = (
load_configuration(os.path.join(os.path.dirname(__file__), "../config.ini"))
)
Loading

0 comments on commit 620a77b

Please sign in to comment.