Skip to content

Commit 9831aca

Browse files
author
Andrew Allen
committed
adding api-key-auth dropwizard bundle
Signed-off-by: Andrew Allen <anallen@cisco.com>
1 parent 676aacb commit 9831aca

37 files changed

+1285
-0
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*
2+
!.git
3+
!ci
4+
!gradle
5+
!subprojects
6+
!build.gradle
7+
!codenarc.groovy
8+
!gradle.properties
9+
!gradlew
10+
!settings.gradle

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_style = space
8+
indent_size = 2
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.bat]
13+
end_of_line = crlf
14+
indent_style = tab
15+
tab_width = 4
16+
17+
# trialing whitespace in markdown can provide line breaks
18+
[*.md]
19+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.c text
7+
*.h text
8+
9+
# Declare files that will always have CRLF line endings on checkout.
10+
*.bat text eol=crlf
11+
12+
# Denote all files that are truly binary and should not be modified.
13+
*.png binary
14+
*.jpg binary
15+
*.zip binary

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
*
2+
3+
!src
4+
!src/**/*
5+
6+
!ci
7+
!ci/*
8+
9+
!gradle
10+
!gradle/**/*
11+
!*gradle*
12+
13+
!subprojects
14+
!subprojects/**/*
15+
subprojects/**/build
16+
17+
!.gitignore
18+
!.gitattributes
19+
!.editorconfig
20+
!.dockerignore
21+
!.travis.yml
22+
!Dockerfile
23+
24+
!LICENSE
25+
!*.md
26+
!codenarc.groovy

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language: bash
2+
3+
services:
4+
- docker
5+
6+
script: "./ci/docker_build.sh"
7+
8+
deploy:
9+
- provider: script
10+
skip_cleanup: true
11+
script: "./ci/publish_latest.sh"
12+
on:
13+
tags: false
14+
branch: master
15+
- provider: script
16+
skip_cleanup: true
17+
script: "./ci/publish_tag.sh"
18+
on:
19+
tags: true
20+
21+
env:
22+
global:
23+
- secure: Rvxt5lhvokgvON26l74TDuQbgQ6I73h0dhAjt4u9SRcFmKYKLM9Sgj+2OWtD9XEj1CfWZaTf0lA57C91fjkPhCklAfN0IjwE2t5cr0YEGSKMgYOGZ8xyyNRPwydwyYpKc/9GYklIeaoAm5EwXYd9RvJ1C8/g6+o18ZKVZyyiEjUfEpeUAyn1Qdfue5ZAi2l/V9BGIv4LqgnwjjTPlaSNEI6smQ63ejiCvFRUeLLgXG1VGGcuv+pOiDm7zdat1FxAjjSaY002xjC5xGDfo73ArD0zvSRm3Gef0ex6HDfKhaw7J9Yv3lgeUBKaa+s6nCOu2naGc99fFjLGnPgAFOHxC+Ba3IU9c3cTI/0tRfBL8N4WVNGxsym/fFTjpAk7awLAA1e2/EWcA4XWtBvhn5VT+wsKu+OSY3kCvAhCsZDQZdkd+y26n00K/bzPyKPrFq0NcynXWv5ccrmoiFyz++OPcgK1DvQ5VvYRyuDVp8+y3CSpBHSzO7Id/AZNpUeYcv+oFqstQbBylNKi4Sl8bZEDmkap9vIwI3TZG330rDILO32xOE/Iy7uUK6419YYkx7LOXM/C9byEsZ1yRuwZWdqGyUUqEnVNwWQ4whL0CBgOzS6QBXUG+9yp9IdVa23Nql6trFTTlTa+TtUpHWUWS6mBoTRIOxZdtX3IMFafforMqUI=
24+
- secure: kqynZDxnxoAGsTV2eNvUH6Pxt0VKUJwD4kfTysBY79iksKYgw4DPBjuaEoPKlrcriL44JSR0wsamawNZEkKpJI1L9M9Lkcg2YfVtX8hhOgVlcg7AgpI711NfNkikzPpoDOaK2HExO3+233cgnbFI3D1GtBxIlQYTYJyYTaS0TV+ZQQelOd2yJacoJF8wNXNfv4ay8XbsvpTvgaKWL7nKuSx1JVt5FT3dri8vSZvVoDwjonP1EGpdZfVTK5xv2sWB4HY70UNBSK1NSgyENUH+YIIG2iPqBSsDPqoAnMP5ZKj093O3Ewc5yaYUcJQqBVnQfji2WXWehcLi7cxvqxjDdoHDum2w5Pp789NWwhsQSHeZC81WffmCWf1bdjjl/16hB3dkZCpmZuEklnYgqaUD449zWWJGV+vY9yyC5xAeF5l+uTlbIYMbccoqBRp4NGC83xKqxPCWwGpzdJLjAXS3PJQwsYyK4pylRvQX4Zzu6jveAHzN5fDgTG+JI0UqwTNxnI2DMNEpaaLx33f67skMV6ulF+DsxX+s1CyY3z0uIojCg5pVLnPto8RlawNZPRqry+Wcj/18LeEe+O+sf7v85QZfKyZoz96hSIFYXkT4n9O8KCcNRXid/+SBgxkfRi70CqqMmTHm8BA3h7ioQ+0i7lyAe2mWb8+wnmgKZ6iLEaY=

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contribution Guidelines
2+
3+
Please visit the [master copy](https://github.com/cratekube/cratekube/blob/master/CONTRIBUTING.md) of CrateKube's contribution guidelines.

Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
######################
2+
## build target ##
3+
######################
4+
FROM openjdk:8u212-jdk-alpine3.9 as build
5+
6+
WORKDIR /app
7+
8+
COPY gradle/wrapper ./gradle/wrapper
9+
COPY gradlew ./
10+
RUN ./gradlew --no-daemon --version
11+
12+
COPY build.gradle gradle.properties settings.gradle ./
13+
COPY gradle/*.gradle ./gradle/
14+
COPY .git ./.git/
15+
16+
## Compile all subprojects, invalidate only if the source changes
17+
COPY subprojects ./subprojects
18+
RUN ./gradlew --no-daemon assemble
19+
20+
## run the static analysis and tests
21+
COPY codenarc.groovy ./
22+
RUN ./gradlew --no-daemon check
23+
24+
## build args required for coveralls reporting
25+
ARG TRAVIS
26+
ARG TRAVIS_JOB_ID
27+
28+
## run code coverage report, send to coveralls when executing in Travis CI
29+
RUN ./gradlew --no-daemon jacocoTestReport coveralls
30+
31+
######################
32+
## publish target ##
33+
######################
34+
FROM build as publish
35+
36+
## setup args needed for bintray tasks
37+
ARG APP_VERSION
38+
ARG JFROG_DEPLOY_USER
39+
ARG JFROG_DEPLOY_KEY
40+
ARG BINTRAY_PUBLISH
41+
42+
COPY ci/maven_publish.sh ./
43+
RUN ./maven_publish.sh

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,53 @@
11
# dropwizard-bundles
2+
[![License](http://img.shields.io/badge/license-APACHE-blue.svg?style=flat)](http://choosealicense.com/licenses/apache-2.0/)
3+
[![SemVer](http://img.shields.io/badge/semver-2.0.0-blue.svg?style=flat)](http://semver.org/spec/v2.0.0)
4+
[![Build Status](https://travis-ci.com/cratekube/dropwizard-groovy-template.svg?branch=master)](https://travis-ci.com/cratekube/dropwizard-groovy-template)
5+
[![Coverage Status](https://coveralls.io/repos/github/cratekube/dropwizard-groovy-template/badge.svg?branch=master)](https://coveralls.io/github/cratekube/dropwizard-groovy-template?branch=master)
6+
27
Repository for custom Dropwizard bundles used in CrateKube repositories
8+
9+
## Dropwizard Bundles
10+
11+
### api-key-auth
12+
The `api-key-auth` bundle provides an extension to Dropwizard authc/authz, allowing you to specify api keys that must
13+
be sent for requests. Usage of this bundle can be seen in the [ApiKeyAuthBundleSpec](subprojects/api-key-auth/src/test/groovy/io/cratekube/dropwizard/auth/ApiKeyAuthBundleSpec.groovy)
14+
integration spec. Multiple keys with associated roles can be configured via a Dropwizard configuration file.
15+
16+
## Local development
17+
18+
### Gradle builds
19+
This project uses [gradle](https://github.com/gradle/gradle) for building and testing. We also use the gradle wrapper
20+
to avoid downloading a local distribution. The commands below are helpful for building and testing.
21+
- `./gradlew build` compile and build
22+
- `./gradlew check` run static code analysis and tests
23+
24+
### Docker builds
25+
We strive to have our builds repeatable across development environments, so we also provide a Docker build to generate
26+
the Dropwizard application container. The examples below should be executed from the root of the project.
27+
28+
Running the base docker build:
29+
```bash
30+
docker build --target build .
31+
```
32+
33+
## Importing bundles into your Dropwizard apps
34+
This project generates a maven asset for each subproject. To use the bundle in your Dropwizard application you will need
35+
to include a dependency using the maven coordinates. To use a bundle include following dependency in your project:
36+
37+
Gradle:
38+
```groovy
39+
implementation 'io.cratekube.dropwizard-bundles:<subproject-name>:1.0.0'
40+
```
41+
42+
Maven:
43+
```xml
44+
<dependency>
45+
<groupId>io.cratekube.dropwizard-bundles</groupId>
46+
<artifactId>subproject-name</artifactId>
47+
<version>1.0.0</version>
48+
</dependency>
49+
```
50+
51+
## Contributing
52+
If you are interested in contributing to this project please review the [contribution guidelines](https://github.com/cratekube/cratekube/blob/master/CONTRIBUTING.md).
53+
Thank you for your interest in CrateKube!

build.gradle

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
plugins {
2+
id 'com.jfrog.bintray' version '1.8.4'
3+
id 'com.jfrog.artifactory' version '4.14.1'
4+
id 'com.github.kt3k.coveralls' version '2.6.3'
5+
}
6+
7+
apply from: 'gradle/config.gradle'
8+
apply from: 'gradle/git.gradle'
9+
10+
allprojects {
11+
apply plugin: 'groovy'
12+
version = System.env.APP_VERSION ?: version
13+
14+
repositories {
15+
mavenLocal()
16+
jcenter()
17+
}
18+
19+
dependencies {
20+
implementation 'org.codehaus.groovy:groovy:3.0.2'
21+
22+
testImplementation 'org.hamcrest:hamcrest-all:1.3'
23+
testImplementation 'org.spockframework:spock-core:2.0-M2-groovy-3.0'
24+
}
25+
}
26+
27+
subprojects {
28+
apply from: "${rootProject.projectDir.path}/gradle/maven.gradle"
29+
apply from: "${rootProject.projectDir.path}/gradle/bintray.gradle"
30+
apply from: "${rootProject.projectDir.path}/gradle/artifactory.gradle"
31+
apply from: "${rootProject.projectDir.path}/gradle/quality.gradle"
32+
}
33+
34+
artifactoryPublish.skip = true
35+
36+
wrapper {
37+
gradleVersion = gradleWrapperVersion
38+
}

ci/docker_build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -o nounset
4+
set -o errexit
5+
6+
## common build args for TravisCI builds
7+
TRAVIS_BUILDARGS=(--build-arg "TRAVIS=${TRAVIS}" --build-arg "TRAVIS_JOB_ID=${TRAVIS_JOB_ID}")
8+
9+
echo "[travis_docker_build] running base docker build"
10+
docker build "${TRAVIS_BUILDARGS[@]}" --target build .

0 commit comments

Comments
 (0)