From 6e3499887de9a64c2868ddc874a9cb949f454949 Mon Sep 17 00:00:00 2001
From: Rohith <gambol99@gmail.com>
Date: Tue, 15 Mar 2016 12:56:06 +0000
Subject: [PATCH] - shifting to version v1.0.0-rc5 - adding a changelog - fixed
 the forbidden page bug - added the templates to the docker base template

---
 CHANGELOG.md                  | 12 ++++++++++++
 Dockerfile                    |  9 +++++----
 doc.go                        |  2 +-
 server.go                     |  4 +++-
 templates/forbidden.html.tmpl | 32 +++++++++++++++++++++++++++++++-
 5 files changed, 52 insertions(+), 7 deletions(-)
 create mode 100644 CHANGELOG.md

diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..f4dcd34
--- /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 8aa789a..385ca3d 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 6037321..4ba991d 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 3c6d2ac..3a012b1 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 6869b5f..ad68227 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>
-- 
GitLab