Skip to content

Commit

Permalink
Improvements, code refactor, frontend
Browse files Browse the repository at this point in the history
* Add html frontend click/copy feature,
  and ability to use your own assets
* Add skip main page (see option
  web_output.skip_main_page)
* Fix multiple client_id in html
  render when using cross_client feature.
  (see option web_output.main_client_id)
* Code refactor
* Add some configuration checks
* Update README with new opts and
  doc for development env
  • Loading branch information
fydrah committed Aug 15, 2018
1 parent cd14bd6 commit 7a17c65
Show file tree
Hide file tree
Showing 19 changed files with 309 additions and 83 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ARG REPO=github.com/fydrah/loginapp
LABEL maintainer="Flavien Hardy <flav.hardy@gmail.com>"

COPY --from=build /go/src/${REPO}/bin/loginapp-static /loginapp
COPY --from=build /go/src/${REPO}/assets /assets

ENTRYPOINT ["/loginapp"]
CMD [""]
68 changes: 59 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

[![Docker Repository on Quay](https://quay.io/repository/fydrah/loginapp/status "Docker Repository on Quay")](https://quay.io/repository/fydrah/loginapp)

**Simple application for Kubernetes CLI configuration with OIDC**
**Web application for Kubernetes CLI configuration with OIDC**

Original source code from [coreos/dex repository](https://github.com/coreos/dex/tree/master/cmd/example-app)

## Usage

```shell
NAME:
loginapp - Simple application for Kubernetes CLI configuration with OIDC
loginapp - Web application for Kubernetes CLI configuration with OIDC

AUTHOR:
fydrah <flav.hardy@gmail.com>
Expand All @@ -31,46 +31,72 @@ GLOBAL OPTIONS:

```yaml
# AppName
# default: mandatory
name: "Kubernetes Auth"
# Bind IP and port (format: "IP:PORT")
# default: mandatory
listen: "0.0.0.0:5555"
# OIDC relative configuration
# OIDC configuration
oidc:
# Client configuration
client:
# Application ID
# default: mandatory
id: "loginapp"
# Application Secret
# default: mandatory
secret: ZXhhbXBsZS1hcHAtc2VjcmV0
# Application Redirect URL
# default: mandatory
redirect_url: "https://127.0.0.1:5555/callback"
# Issuer configuration
issuer:
# Location of issuer root CA certificate
# default: mandatory
root_ca: "example/ssl/ca.pem"
# Issuer URL
# default: mandatory
url: "https://dex.example.com:5556"
# Extra scopes
# default: []
extra_scopes:
- groups
# Enable offline scope
# default: false
offline_as_scope: true
# Request token on behalf of other clients
# default: []
cross_clients: []
# Tls support
tls:
# Enable tls termination
# default: false
enabled: true
# Certificate location
# default: mandatory if tls.enabled is true
cert: example/ssl/cert.pem
# Key location
# default: mandatory if tls.enabled is true
key: example/ssl/key.pem
# Logging configuration
log:
# Loglevel: debug|info|warning|error|fatal|panic
# default: info
level: debug
# Log format: json|text
# default: json
format: json
# Configure the web behavior
web_output:
# ClientID to output (useful for cross_client)
# default: 'oidc.client.id'
main_client_id: loginapp
# Assets directory
# default: ${pwd}/assets
assets_dir: /assets
# Skip main page of login app
# default: false
skip_main_page: false
```
## Kubernetes
Expand All @@ -82,7 +108,7 @@ This application is built to run on a Kubernetes cluster. You will find usage ex
## Dev
* Setup Dex
###### Setup Dex
```
# Configure github oauth secrets if needed.
Expand All @@ -96,10 +122,10 @@ EOF
docker-compose up -d
```

* User: admin@example.com
* Password: password
* User: admin@example.com
* Password: password

* Manage dependencies
###### Manage dependencies

Loginapp uses [golang dep](https://golang.github.io/dep/docs/installation.html).

Expand All @@ -108,7 +134,7 @@ Loginapp uses [golang dep](https://golang.github.io/dep/docs/installation.html).
dep ensure
```

* Compile, configure and run
###### Compile, configure and run

Configuration files are located in [example directory](./example/)

Expand All @@ -117,7 +143,31 @@ Configuration files are located in [example directory](./example/)
bin/loginapp serve example/config-loginapp.yaml
```

## Contibutions
You can also build a temporary Docker image for loginapp, and
run it with docker-compose (uncomment lines and replace image name):

```
make docker-tmp
```

###### Run checks

Some checks can be launched before commits:
* errorcheck: check for unchecked errors
* gocyclo: cyclomatic complexities of functions
* gosimple: simplify code

```
make checks
```

Run also gofmt before any new commit:

```
make gofmt
```

## Contributions

Contributions (and issues) are welcomed.

Expand Down
5 changes: 5 additions & 0 deletions assets/css/code-box-copy.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/css/form-style.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions assets/css/prism.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions assets/img/file_copy-24px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions assets/img/ic-copy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7a17c65

Please sign in to comment.