Skip to content

Commit

Permalink
Merge pull request #97 from devopsfaith/0.8.0-dev
Browse files Browse the repository at this point in the history
Release the 0.8.0
  • Loading branch information
kpacha authored Mar 9, 2019
2 parents 3445cc0 + 54a0890 commit fcdb65f
Show file tree
Hide file tree
Showing 33 changed files with 325 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.7
FROM alpine:3.9

LABEL maintainer="[email protected]"

Expand Down
12 changes: 6 additions & 6 deletions Gopkg.lock

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

4 changes: 2 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
version = "3.3.12"

[[override]]
branch = "master"
version = "0.8.0"
name = "github.com/devopsfaith/krakend"

[[override]]
Expand Down Expand Up @@ -104,7 +104,7 @@
name = "github.com/devopsfaith/krakend-opencensus"

[[constraint]]
branch = "master"
version = "0.8.1"
name = "github.com/devopsfaith/krakend-jose"

[[constraint]]
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
BIN_NAME :=krakend
DEP_VERSION=0.5.0
OS := $(shell uname | tr '[:upper:]' '[:lower:]')
VERSION := 0.7.1
VERSION := 0.8.0
PKGNAME := krakend
LICENSE := Apache 2.0
VENDOR=
Expand All @@ -20,7 +20,7 @@ MAINTAINER := Daniel Ortiz <[email protected]>
DOCKER_WDIR := /tmp/fpm
DOCKER_FPM := devopsfaith/fpm
DOCKER_DEP := instrumentisto/dep:0.5.0-alpine
GOLANG_VERSION := 1.11.5
GOLANG_VERSION := 1.12
GOBASEDIR=src/github.com/devopsfaith/krakend-ce

FPM_OPTS=-s dir -v $(VERSION) -n $(PKGNAME) \
Expand Down
2 changes: 1 addition & 1 deletion builder/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM golang:1.11.5-alpine3.7
FROM golang:1.12-alpine3.9

RUN apk add --no-cache make curl git build-base
5 changes: 4 additions & 1 deletion executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ func NewExecutor(ctx context.Context) cmd.Executor {
return jose.RejecterFunc(rejecter.RejectToken)
}),
jose.RejecterFactoryFunc(func(l logging.Logger, cfg *config.EndpointConfig) jose.Rejecter {
return cel.NewRejecter(l, cfg)
if r := cel.NewRejecter(l, cfg); r != nil {
return r
}
return jose.FixedRejecter(false)
}),
})

Expand Down
91 changes: 91 additions & 0 deletions tests/fixtures/krakend.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,31 @@
]
}
},
{
"endpoint": "/cel/jwt/{id}",
"backend": [
{
"host": [ "http://127.0.0.1:8080" ],
"url_pattern": "/__debug/{id}"
}
],
"extra_config":{
"github.com/devopsfaith/krakend-cel": [
{
"check_expr": "size(JWT.roles)>1"
}
],
"github.com/devopsfaith/krakend-jose/validator": {
"alg": "HS256",
"audience": ["http://api.example.com"],
"roles_key": "roles",
"issuer": "https://krakend.io",
"roles": ["role_a", "role_b", "role_y"],
"jwk-url": "http://127.0.0.1:8081/jwk/symmetric",
"disable_jwk_security": true
}
}
},
{
"endpoint": "/param_forwarding/some/{foo}/{bar}",
"headers_to_pass": [
Expand Down Expand Up @@ -316,6 +341,72 @@
"url_pattern": "/redirect/?status={code}"
}
]
},
{
"endpoint": "/private/custom",
"backend": [
{
"host": [ "http://127.0.0.1:8080" ],
"url_pattern": "/__debug",
"blacklist": ["message"]
}
],
"extra_config": {
"github.com/devopsfaith/krakend/proxy": {
"static": {
"strategy": "always",
"data": {
"id_user": 1,
"firstName": "John",
"lastName": "Smith",
"age": 25
}
}
},
"github.com/devopsfaith/krakend-jose/validator": {
"alg": "HS256",
"audience": ["http://api.example.com"],
"roles_key": "roles",
"issuer": "https://krakend.io",
"roles": ["role_a", "role_c"],
"jwk-url": "http://127.0.0.1:8081/jwk/symmetric",
"disable_jwk_security": true
}
}
},
{
"endpoint": "/token",
"backend": [
{
"host": [ "http://127.0.0.1:8080" ],
"url_pattern": "/__debug",
"blacklist": ["message"]
}
],
"extra_config": {
"github.com/devopsfaith/krakend/proxy": {
"static": {
"strategy": "always",
"data": {
"access_token": {
"aud": "http://api.example.com",
"iss": "https://krakend.io",
"sub": "1234567890qwertyuio",
"jti": "mnb23vcsrt756yuiomnbvcx98ertyuiop",
"roles": ["role_y"],
"exp": 1735689600
}
}
}
},
"github.com/devopsfaith/krakend-jose/signer": {
"alg": "HS256",
"kid": "sim2",
"keys-to-sign": ["access_token"],
"jwk-url": "http://127.0.0.1:8081/jwk/symmetric",
"disable_jwk_security": true
}
}
}
]
}
4 changes: 2 additions & 2 deletions tests/fixtures/specs/backend_301.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
},
"out": {
"status_code": 200,
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=301\"],\"User-Agent\":[\"KrakenD Version 0.7.1\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"301\"]}}",
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=301\"],\"User-Agent\":[\"KrakenD Version 0.8.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"301\"]}}",
"header": {
"content-type": "application/json; charset=utf-8",
"Cache-Control": "public, max-age=3600",
"X-Krakend-Completed": "true"
}
}
}
}
4 changes: 2 additions & 2 deletions tests/fixtures/specs/backend_302.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
},
"out": {
"status_code": 200,
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=302\"],\"User-Agent\":[\"KrakenD Version 0.7.1\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"302\"]}}",
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=302\"],\"User-Agent\":[\"KrakenD Version 0.8.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"302\"]}}",
"header": {
"content-type": "application/json; charset=utf-8",
"Cache-Control": "public, max-age=3600",
"X-Krakend-Completed": "true"
}
}
}
}
4 changes: 2 additions & 2 deletions tests/fixtures/specs/backend_303.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
},
"out": {
"status_code": 200,
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=303\"],\"User-Agent\":[\"KrakenD Version 0.7.1\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"303\"]}}",
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=303\"],\"User-Agent\":[\"KrakenD Version 0.8.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"303\"]}}",
"header": {
"content-type": "application/json; charset=utf-8",
"Cache-Control": "public, max-age=3600",
"X-Krakend-Completed": "true"
}
}
}
}
4 changes: 2 additions & 2 deletions tests/fixtures/specs/backend_307.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
},
"out": {
"status_code": 200,
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=307\"],\"User-Agent\":[\"KrakenD Version 0.7.1\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"307\"]}}",
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=307\"],\"User-Agent\":[\"KrakenD Version 0.8.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"307\"]}}",
"header": {
"content-type": "application/json; charset=utf-8",
"Cache-Control": "public, max-age=3600",
"X-Krakend-Completed": "true"
}
}
}
}
1 change: 1 addition & 0 deletions tests/fixtures/specs/cel-3.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"body": "{\"backend2\":{\"message\":\"pong\"}}",
"header": {
"content-type": "application/json; charset=utf-8",
"X-Krakend-Completed": "false",
"Cache-Control": ""
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/specs/cel-4.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"body": "{\"backend1\":{\"message\":\"pong\"}}",
"header": {
"content-type": "application/json; charset=utf-8",
"X-Krakend-Completed": "false",
"Cache-Control": ""
}
}
Expand Down
17 changes: 17 additions & 0 deletions tests/fixtures/specs/cel-6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"in": {
"method": "GET",
"url": "http://localhost:8080/cel/jwt/ko",
"header": {
"authorization": "bearer yJhbGciOiJIUzI1NiIsImtpZCI6InNpbTIifQ.eyJhdWQiOiJodHRwOi8vYXBpLmV4YW1wbGUuY29tIiwiZXhwIjoxNzM1Njg5NjAwLCJpc3MiOiJodHRwczovL2tyYWtlbmQuaW8iLCJqdGkiOiJtbmIyM3Zjc3J0NzU2eXVpb21uYnZjeDk4ZXJ0eXVpb3AiLCJyb2xlcyI6WyJyb2xlX3kiXSwic3ViIjoiMTIzNDU2Nzg5MHF3ZXJ0eXVpbyJ9.LRUfHzFra-9kmG_VTqA1FWFEbe3yZon7Y8yWN6CGPzk"
}
},
"out": {
"status_code": 401,
"body": "",
"header": {
"content-type": "",
"Cache-Control": ""
}
}
}
18 changes: 18 additions & 0 deletions tests/fixtures/specs/cel-7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"in": {
"method": "GET",
"url": "http://localhost:8080/cel/jwt/ok",
"header": {
"authorization": "bearer eyJhbGciOiJIUzI1NiIsImtpZCI6InNpbTIifQ.eyJhdWQiOiJodHRwOi8vYXBpLmV4YW1wbGUuY29tIiwiZXhwIjoxNzM1Njg5NjAwLCJpc3MiOiJodHRwczovL2tyYWtlbmQuaW8iLCJqdGkiOiJtbmIyM3Zjc3J0NzU2eXVpb21uYnZjeDk4ZXJ0eXVpb3AiLCJyb2xlcyI6WyJyb2xlX2EiLCJyb2xlX2IiXSwic3ViIjoiMTIzNDU2Nzg5MHF3ZXJ0eXVpbyJ9.htgbhantGcv6zrN1i43Rl58q1sokh3lzuFgzfenI0Rk"
}
},
"out": {
"status_code": 200,
"body": "{\"message\":\"pong\"}",
"header": {
"content-type": "application/json; charset=utf-8",
"Cache-Control": "public, max-age=3600",
"X-Krakend-Completed": "true"
}
}
}
24 changes: 24 additions & 0 deletions tests/fixtures/specs/cors_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"in": {
"method": "OPTIONS",
"url": "http://localhost:8080/param_forwarding/some/foo/bar?a=1&b=2",
"header": {
"User-Agent": "some",
"Origin": "http://foo.example",
"Access-Control-Request-Method": "GET",
"Access-Control-Request-Headers": "X-PINGOTHER"
}
},
"out": {
"status_code": 200,
"body": "",
"header": {
"content-type": "",
"Cache-Control": "",
"X-Krakend-Completed": "",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "POST,GET",
"Access-Control-Allow-Headers": "Origin,Authorization,Content-Type"
}
}
}
24 changes: 24 additions & 0 deletions tests/fixtures/specs/cors_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"in": {
"method": "OPTIONS",
"url": "http://localhost:8080/param_forwarding/some/foo/bar?a=1&b=2",
"header": {
"User-Agent": "some",
"Origin": "http://foo.example.tld",
"Access-Control-Request-Method": "PUT",
"Access-Control-Request-Headers": "X-PINGOTHER"
}
},
"out": {
"status_code": 200,
"body": "",
"header": {
"content-type": "",
"Cache-Control": "",
"X-Krakend-Completed": "",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "POST,GET",
"Access-Control-Allow-Headers": "Origin,Authorization,Content-Type"
}
}
}
4 changes: 2 additions & 2 deletions tests/fixtures/specs/detail_error.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
},
"out": {
"status_code": 200,
"body": "{\"error_backend_b\":{\"http_status_code\":404,\"http_body\":\"404 page not found\\n\"},\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"User-Agent\":[\"KrakenD Version 0.7.1\"]},\"path\":\"/param_forwarding/\",\"query\":{}}",
"body": "{\"error_backend_b\":{\"http_status_code\":404,\"http_body\":\"404 page not found\\n\"},\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"User-Agent\":[\"KrakenD Version 0.8.0\"]},\"path\":\"/param_forwarding/\",\"query\":{}}",
"header": {
"content-type": "application/json; charset=utf-8",
"Cache-Control": "",
"X-Krakend-Completed": "false"
}
}
}
}
Loading

0 comments on commit fcdb65f

Please sign in to comment.