Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
Migrate the codebase from Gatekeeper repository #516
Browse files Browse the repository at this point in the history
Co-authored-by: Stian Thorgersen <stian@redhat.com>
  • Loading branch information
Bruno Oliveira da Silva and stianst committed May 6, 2020
1 parent 8e57b71 commit c500821
Show file tree
Hide file tree
Showing 20 changed files with 81 additions and 102 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

*.swp
.idea/
.vscode/
bin/
vendor/
release/
Expand All @@ -11,6 +12,7 @@ test.sock
tests/redis.conf
tests/*.csr
*.orig
*.code-workspace
debug

*.iml
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ language: go

matrix:
include:
- go: 1.13.x
- go: 1.12.x
env: GO111MODULE=on
- go: 1.11.x
env: GO111MODULE=on

install:
- go get github.com/mattn/goveralls
Expand Down
44 changes: 22 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# Keycloak Community
# Louketo Community

Keycloak Gatekeeper is an Open Source adapter solution to protect non-Java modern Applications and Services.
Louketo Proxy is an Open Source adapter solution to protect non-Java modern Applications and Services.

## Building and working with the codebase

Details for building from source and working with the codebase are provided in the [building and working with the code base](docs/building.md) guide.

## Contributing to Gatekeeper
## Contributing to Louketo

Gatekeeper is an Open Source community-driven project and we welcome contributions as well as feedback from the community.
Louketo is an Open Source community-driven project and we welcome contributions as well as feedback from the community.

We do have a few guidelines in place to help you be successful with your contribution.

Here's a quick checklist for a good PR, more details below:

1. [Keycloak Dev Mailing List](https://groups.google.com/forum/#!forum/keycloak-dev)
2. A JIRA associated with the PR
1. [Louketo Mailing List](https://groups.google.com/forum/#!forum/louketo)
2. The issue number associated with the PR
3. One feature/change per PR
4. One commit per PR
5. PR rebased on master (`git rebase`, not `git pull`)
5. Commit message is prefixed by JIRA number
6. No changes to code not directly related to your PR
7. Includes test
8. Includes documentation
6. Commit message including the GitHub issue number
7. No changes to code not directly related to your PR
8. Includes test
9. Includes documentation

Once you have submitted your PR please monitor it for comments/feedback. We reserve the right to close inactive PRs if
you do not respond within 2 weeks (bear in mind you can always open a new PR if it is closed due to inactivity).
Expand All @@ -32,21 +32,21 @@ not be able to respond to your PR immediately. The best place to ping us is on t

### Finding something to work on

If you would like to contribute to Keycloak, but are not sure exactly what to work on, you can find a number of open
If you would like to contribute to Louketo, but are not sure exactly what to work on, you can find a number of open
issues that are awaiting contributions in the
[Keycloak JIRA](https://issues.jboss.org/projects/KEYCLOAK/versions/12340167).
[GitHub Issues](https://github.com/louketo/louketo-proxy/issues).

### Open a discussion on Keycloak Dev Mailing List
### Open a discussion on Louketo Mailing List

As Keycloak is a community-driven project we require contributors to send a description of what they are planning to
work on to the [Keycloak Dev Mailing List](https://groups.google.com/forum/#!forum/keycloak-dev).
As Louketo is a community-driven project we require contributors to send a description of what they are planning to
work on to the [Louketo Mailing List](https://groups.google.com/forum/#!forum/Louketo-dev).

We recommend starting the discussion prior to submitting your PR. Through the mailing list you can get valuable
feedback both from the core Keycloak team as well as the wider community.
feedback both from the core Louketo team as well as the wider community.

### Create an issue in Keycloak JIRA
### Create an issue in GitHub Issues

Take your time to write a proper JIRA including a good summary and description.
Take your time to write a proper issue including a good summary and description.

Remember this may be the first thing a reviewer of your PR will look at to get an idea of what you are proposing
and it will also be used by the community in the future to find about what new features and enhancements are included in
Expand All @@ -63,9 +63,9 @@ refactoring.

### Documentation

We require contributions to include relevant documentation. Alongside your PR for code changes, prepare a PR to the [Keycloak Documentation](https://github.com/keycloak/keycloak-documentation).
We require contributions to include relevant documentation. Alongside your PR for code changes, prepare a PR to the [Louketo Documentation](https://github.com/Louketo/Louketo-documentation).

In the description of your PR include a link to the PR to [Keycloak Documentation](https://github.com/keycloak/keycloak-documentation).
In the description of your PR include a link to the PR to [Louketo Documentation](https://github.com/Louketo/Louketo-documentation).

### Submitting your PR

Expand All @@ -82,5 +82,5 @@ for more details.
The above helps us review your PR and also makes it easier for us to maintain the repository. It is also required by
our automatic merging process.

We also require that the commit message is prefixed with the Keycloak JIRA issue number (example commit message
"KEYCLOAK-9876 My super cool new feature").
We also require that the commit message is prefixed with the GitHub issue number (example commit message
"My super cool new feature #9876").
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME=keycloak-gatekeeper
AUTHOR=keycloak
NAME=louketo-proxy
AUTHOR=louketo
REGISTRY=docker.io
GOVERSION ?= 1.10.2
ROOT_DIR=${PWD}
Expand Down Expand Up @@ -43,9 +43,9 @@ docker-build:
docker-test:
@echo "--> Running the docker test"
docker run --rm -ti -p 3000:3000 \
-v ${ROOT_DIR}/config.yml:/etc/keycloak/config.yml:ro \
-v ${ROOT_DIR}/config.yml:/etc/louketo/config.yml:ro \
-v ${ROOT_DIR}/tests:/opt/tests:ro \
${REGISTRY}/${AUTHOR}/${NAME}:${VERSION} --config /etc/keycloak/config.yml
${REGISTRY}/${AUTHOR}/${NAME}:${VERSION} --config /etc/louketo/config.yml

docker-release:
@echo "--> Building a release image"
Expand Down
39 changes: 11 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,46 @@
# Keycloak
# Louketo Proxy

Keycloak is an Open Source Identity and Access Management solution for modern Applications and Services.

This repository contains the source code for the Keycloak Gatekeeper. The Gatekeeper is most happy in the company of Keycloak, but is also able to make friends with other OpenID Connect providers. The service supports both access tokens in browser cookie or bearer tokens.
This repository contains the source code for the Louketo Proxy.

## Help and Documentation

* [Gatekeeper documentation](https://www.keycloak.org/docs/latest/securing_apps/index.html#_keycloak_generic_adapter)
* [Keycloak documentation](https://www.keycloak.org/documentation.html)
* [User Mailing List](https://groups.google.com/d/forum/keycloak-user) - Mailing list for help and general questions about Keycloak
* [JIRA](https://issues.jboss.org/projects/KEYCLOAK) - Issue tracker for bugs and feature requests
* [Louketo Proxy documentation](https://louketo.github.io/)
* [Mailing List](https://groups.google.com/forum/#!forum/louketo) - Mailing list for help and general questions about Keycloak
* [Issue Tracker](https://github.com/louketo/louketo-proxy/issues) - Issue tracker for bugs and feature requests


## Reporting Security Vulnerabilities

If you've found a security vulnerability, please look at the [instructions on how to properly report it](http://www.keycloak.org/security.html)
If you've found a security vulnerability, please report send an e-mail to <louketo-security@googlegroups.com>


## Reporting an issue

If you believe you have discovered a defect in Gatekeeper please open an issue in our [Issue Tracker](https://issues.jboss.org/projects/KEYCLOAK).
If you believe you have discovered a defect in Louketo Proxy please open an issue in our [Issue Tracker](https://github.com/louketo/louketo-proxy/issues).
Please remember to provide a good summary, description as well as steps to reproduce the issue.


## Getting started

To run Gatekeeper download the distribution from our [website](https://www.keycloak.org/downloads.html). Extract it and run:

./keycloak-gatekeeper[.exe]
To run Louketo Proxy, please refer to our [building and working with the code base](docs/building.md) guide. Alternatively, you can use the Docker image by running:

Alternatively, you can use the Docker image by running:

docker run -it --rm quay.io/keycloak/keycloak-gatekeeper
docker run -it --rm quay.io/louketo/louketo-proxy

This comment has been minimized.

Copy link
@willseeyou

willseeyou Jun 5, 2020

It seems quay.io does not have this repo yet.

This comment has been minimized.

Copy link
@abstractj

abstractj Jun 5, 2020

@willseeyou you're correct. @ASzc is working on #609 and we will provide it in the upcoming releases. If you would like to join the discussions, you're more than welcome.


For more details refer to the [Documentation](https://www.keycloak.org/docs/latest/securing_apps/index.html#_keycloak_generic_adapter).


## Building from Source

To build from source refer to the [building and working with the code base](docs/building.md) guide.
For more details refer to the [Documentation](https://louketo.github.io/).

### Writing Tests

To write tests refer to the [writing tests](docs/tests-development.md) guide.

## Contributing

Before contributing to Gatekeeper please read our [contributing guidelines](CONTRIBUTING.md).

Before contributing to Louketo Proxy please read our [contributing guidelines](CONTRIBUTING.md).

## Other Keycloak Projects

* [Keycloak](https://github.com/keycloak/keycloak) - Keycloak Server and Java adapters
* [Keycloak Documentation](https://github.com/keycloak/keycloak-documentation) - Documentation for Keycloak
* [Keycloak QuickStarts](https://github.com/keycloak/keycloak-quickstarts) - QuickStarts for getting started with Keycloak
* [Keycloak Docker](https://github.com/jboss-dockerfiles/keycloak) - Docker images for Keycloak
* [Keycloak Node.js Connect](https://github.com/keycloak/keycloak-nodejs-connect) - Node.js adapter for Keycloak
* [Keycloak Node.js Admin Client](https://github.com/keycloak/keycloak-nodejs-admin-client) - Node.js library for Keycloak Admin REST API


## License

Expand Down
2 changes: 1 addition & 1 deletion cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newOauthProxyApp() *cli.App {
app.Author = author
app.Email = email
app.Flags = getCommandLineOptions()
app.UsageText = "keycloak-gatekeeper [options]"
app.UsageText = "louketo-proxy [options]"

// step: the standard usage message isn't that helpful
app.OnUsageError = func(context *cli.Context, err error, isSubcommand bool) error {
Expand Down
8 changes: 4 additions & 4 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ var (
type contextKey int8

const (
prog = "keycloak-gatekeeper"
author = "Keycloak"
email = "keycloak-user@lists.jboss.org"
prog = "louketo-proxy"
author = "Louketo"
email = "louketo@googlegroups.com"
description = "is a proxy using the keycloak service for auth and authorization"

authorizationHeader = "Authorization"
Expand Down Expand Up @@ -212,7 +212,7 @@ type Config struct {
EnableDefaultDeny bool `json:"enable-default-deny" yaml:"enable-default-deny" usage:"enables a default denial on all requests, you have to explicitly say what is permitted (recommended)"`
// EnableEncryptedToken indicates the access token should be encoded
EnableEncryptedToken bool `json:"enable-encrypted-token" yaml:"enable-encrypted-token" usage:"enable encryption for the access tokens"`
// ForceEncryptedCookie indicates that the access token in the cookie should be encoded, regardless what EnableEncryptedToken says. This way, gatekeeper may receive tokens in header in the clear, whereas tokens in cookies remain encrypted
// ForceEncryptedCookie indicates that the access token in the cookie should be encoded, regardless what EnableEncryptedToken says. This way, Louketo Proxy may receive tokens in header in the clear, whereas tokens in cookies remain encrypted
ForceEncryptedCookie bool `json:"force-encrypted-cookie" yaml:"force-encrypted-cookie" usage:"force encryption for the access tokens in cookies"`
// EnableLogging indicates if we should log all the requests
EnableLogging bool `json:"enable-logging" yaml:"enable-logging" usage:"enable http logging of the requests"`
Expand Down
21 changes: 10 additions & 11 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,33 @@ Ensure you have Golang 1.11 (or newer) and Git installed
go version
git --version

First clone the Gatekeeper repository:
First clone the Louketo Proxy repository:

git clone https://github.com/keycloak/keycloak-gatekeeper.git
cd keycloak-gatekeeper
git clone https://github.com/louketo/louketo-proxy.git
cd louketo

To build Gatekeeper run:
To build Louketo Proxy run:

make && make test

This will compile Go files and package the results into a binary file inside `bin/keycloak-gatekeeper` and run the testsuite.
This will compile Go files and package the results into a binary file inside `bin/louketo-proxy` and run the testsuite.

To build a distribution run:

make release

Once completed you will find distribution archives in the `release` folder.

## Starting Gatekeeper
## Starting Louketo

To start Gatekeeper during development first build as specified above, then run:
To start Louketo Proxy during development first build as specified above, then run:

bin/keycloak-gatekeeper
bin/louketo-proxy

## Working with the codebase

We don't currently enforce a code style in Gatekeeper, because Go already have tools to ensure that code is properly formatted. Before submitting any pull request, please run:
We don't currently enforce a code style in Louketo, because Go already have tools to ensure that code is properly formatted. Before submitting any pull request, please run:

make format && make lint

If your changes require introducing new dependencies or updating dependency versions please discuss this first on the
dev mailing list. We do not accept new dependencies to be added lightly, so try to use what is available.
If your changes require introducing new dependencies or updating dependency versions please discuss this first on the mailing list. We do not accept new dependencies to be added lightly, so try to use what is available.
3 changes: 0 additions & 3 deletions docs/pull_request_template.md

This file was deleted.

7 changes: 2 additions & 5 deletions docs/tests-development.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
## Writing tests

When writing tests please follow the same approach as we have taken in the other tests. There are many ways to
test software and we have chosen ours, so please appreciate that.
When writing tests please follow the same approach as we have taken in the other tests. There are many ways to test software and we have chosen ours, so please appreciate that.

The main tests are provided in files with the suffix `_test.go` and can be executed by running:

make test

When developing your test depending on the feature or enhancement you are testing you may find it best to add to an
existing test, or to write a test from scratch. For the latter, we recommend finding another test that is close to what
you need and use that as a basis.
When developing your test depending on the feature or enhancement you are testing you may find it best to add to an existing test, or to write a test from scratch. For the latter, we recommend finding another test that is close to what you need and use that as a basis.
6 changes: 3 additions & 3 deletions e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func checkListenOrBail(endpoint string) bool {
return limit < maxWaitCycles
}

func runTestGatekeeper(t *testing.T, config *Config) error {
func runTestLouketo(t *testing.T, config *Config) error {
proxy, err := newProxy(config)
if err != nil {
return err
Expand Down Expand Up @@ -140,8 +140,8 @@ func TestCorsWithUpstream(t *testing.T) {
// launch fake oauth OIDC server
_ = runTestAuth(t)

// launch keycloak-gatekeeper proxy
_ = runTestGatekeeper(t, config)
// launch louketo-proxy proxy
_ = runTestLouketo(t, config)

// ok now exercise the ensemble with a CORS-enabled request
client := http.Client{}
Expand Down
2 changes: 1 addition & 1 deletion forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (r *oauthProxy) proxyMiddleware(next http.Handler) http.Handler {
req.Header.Set("X-Forwarded-Proto", req.Header.Get("X-Forwarded-Proto"))

if len(r.config.CorsOrigins) > 0 {
// if CORS is enabled by gatekeeper, do not propagate CORS requests upstream
// if CORS is enabled by Louketo Proxy, do not propagate CORS requests upstream
req.Header.Del("Origin")
}
// @step: add any custom headers to the request
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/keycloak/keycloak-gatekeeper
module github.com/louketo/louketo-proxy

require (
github.com/PuerkitoBio/purell v1.1.0
Expand Down
14 changes: 8 additions & 6 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/bash -e
NAME="keycloak-gatekeeper"
NAME="louketo-proxy"
PLATFORMS="darwin linux windows"
ARCHITECTURES="amd64"
GIT_SHA=$(git --no-pager describe --always --dirty)
BUILD_TIME=$(date '+%s')
LFLAGS="-X main.gitsha=$GIT_SHA -X main.compiled=$BUILD_TIME"

DIR="$PWD"
VERSION=`./get-version.sh`
# Release an Alpha so we can provide all the binaries for people to give it a try
VERSION="1.0.0-alpha"
echo "Version: $VERSION"

TMP=`mktemp -d`
Expand Down Expand Up @@ -45,11 +46,12 @@ echo ""
clean
release

echo "------------------------------------------------------------------------------------------------------------"
echo "Upload to jboss.org:"
echo ""
# TODO Use goreleases instead
#echo "------------------------------------------------------------------------------------------------------------"
#echo "Upload to jboss.org:"
#echo ""

rsync -rv --protocol=28 $DIR/release/* keycloak@filemgmt.jboss.org:/downloads_htdocs/keycloak/$VERSION/gatekeeper/
#rsync -rv --protocol=28 $DIR/release/* keycloak@filemgmt.jboss.org:/downloads_htdocs/keycloak/$VERSION/louketo/

echo "------------------------------------------------------------------------------------------------------------"
echo "Done"
Expand Down
Loading

0 comments on commit c500821

Please sign in to comment.