diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..f4dcd34b7d894b87c684cbc339dec9f3832cc4ce --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ + +#### **1.0.0-rc5 (March 15th, 2016)** + +FEATURES: + + * Added the realm access roles for keycloak, beforehand the user contect + was only parses roles which were from client applications + +BUGS: + + * Fixed the gitlab-ci build scripts + * Fixed the custom forbidden page bug \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8aa789ac8548f981f623aaaacc4b53270a11611f..385ca3d70d38d4b89a746767fbfd7dd407a84eb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,10 @@ MAINTAINER Rohith <gambol99@gmail.com> RUN apk update && \ apk add ca-certificates -ADD bin/keycloak-proxy /opt/bin/keycloak-proxy -RUN chmod +x /opt/bin/keycloak-proxy +ADD templates/ opt/templates +ADD bin/keycloak-proxy /opt/keycloak-proxy +RUN chmod +x /opt/keycloak-proxy -WORKDIR "/opt/bin" +WORKDIR "/opt" -ENTRYPOINT [ "/opt/bin/keycloak-proxy" ] +ENTRYPOINT [ "/opt/keycloak-proxy" ] diff --git a/doc.go b/doc.go index 6037321335c4634012aa77c25fbe20e01ec9f040..4ba991d61ce4ee159e8f4611122d634b112f79dc 100644 --- a/doc.go +++ b/doc.go @@ -22,7 +22,7 @@ import ( const ( prog = "keycloak-proxy" - version = "v1.0.0-rc3" + version = "v1.0.0-rc5" author = "Rohith" email = "gambol99@gmail.com" description = "is a proxy using the keycloak service for auth and authorization" diff --git a/server.go b/server.go index 3c6d2ac173fac66980285d97a70ec9d2fa29bce0..3a012b1f29c2fa1670ea7c83e955b87e437ef23a 100644 --- a/server.go +++ b/server.go @@ -24,6 +24,7 @@ import ( "net/http" "net/http/httputil" "net/url" + "path" "strings" "sync" "time" @@ -149,6 +150,7 @@ func (r *KeycloakProxy) initializeTemplates() { } if len(list) > 0 { + log.Infof("loading the custom templates: %s", strings.Join(list, ",")) r.router.LoadHTMLFiles(list...) } } @@ -207,7 +209,7 @@ func (r KeycloakProxy) redirectToURL(url string, cx *gin.Context) { func (r KeycloakProxy) accessForbidden(cx *gin.Context) { // step: do we have a custom forbidden page if r.config.hasForbiddenPage() { - cx.HTML(http.StatusForbidden, r.config.ForbiddenPage, r.config.TagData) + cx.HTML(http.StatusForbidden, path.Base(r.config.ForbiddenPage), r.config.TagData) cx.Abort() return } diff --git a/templates/forbidden.html.tmpl b/templates/forbidden.html.tmpl index 6869b5f6804fef0539967783b86e57fc4946400c..ad682271d1d4fb038f923d51b1a3b29f6c21fec0 100644 --- a/templates/forbidden.html.tmpl +++ b/templates/forbidden.html.tmpl @@ -1,5 +1,35 @@ +<!DOCTYPE html> <html> +<head> + <meta charset="UTF-8"> + <title>403 - Access Forbidden</title> + <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> + <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> + <style> + .oops { + font-size: 9em; + letter-spacing: 2px; + } + .message { + font-size: 3em; + } + </style> +</head> <body> -Access Forbidden + <div class="container text-center"> + <div class="row vcenter" style="margin-top: 20%;"> + <div class="col-md-12"> + <div class="error-template"> + <h1 class="oops">Oops!</h1> + <h2 class="message">503 Permission Denied</h2> + <div class="error-details"> + Sorry, you do not have accces to this page, please consult with the application administrator + </div> + </div> + </div> + </div> +</div> + </body> </html>