Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
keycloak-proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Janne Mareike Koschinski
keycloak-proxy
Commits
ff230d7d
Commit
ff230d7d
authored
Jan 19, 2017
by
Rohith Jayawardene
Committed by
GitHub
Jan 19, 2017
Browse files
Options
Downloads
Patches
Plain Diff
Fixes (#179)
- making a few noop changes
parent
1aaebaef
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
rotation.go
+4
-11
4 additions, 11 deletions
rotation.go
rotation_test.go
+1
-1
1 addition, 1 deletion
rotation_test.go
with
5 additions
and
12 deletions
rotation.go
+
4
−
11
View file @
ff230d7d
...
@@ -19,7 +19,6 @@ import (
...
@@ -19,7 +19,6 @@ import (
"crypto/tls"
"crypto/tls"
"fmt"
"fmt"
"path"
"path"
"strings"
"sync"
"sync"
log
"github.com/Sirupsen/logrus"
log
"github.com/Sirupsen/logrus"
...
@@ -77,22 +76,16 @@ func (c *certificationRotation) watch() error {
...
@@ -77,22 +76,16 @@ func (c *certificationRotation) watch() error {
if
!
containedIn
(
event
.
Name
,
filewatchPaths
)
{
if
!
containedIn
(
event
.
Name
,
filewatchPaths
)
{
continue
continue
}
}
// step: we have to reload the certificate
log
.
WithFields
(
log
.
Fields
{
"filename"
:
event
.
Name
,
"event"
:
strings
.
ToLower
(
event
.
Op
.
String
()),
})
.
Debugf
(
"the certificate file has thrown a file event"
)
// step: reload the certificate
// step: reload the certificate
certificate
,
err
:=
tls
.
LoadX509KeyPair
(
c
.
certificateFile
,
c
.
privateKeyFile
)
certificate
,
err
:=
tls
.
LoadX509KeyPair
(
c
.
certificateFile
,
c
.
privateKeyFile
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
WithFields
(
log
.
Fields
{
log
.
WithFields
(
log
.
Fields
{
"filename"
:
event
.
Name
,
"filename"
:
event
.
Name
,
"error"
:
err
.
Error
(),
"error"
:
err
.
Error
(),
})
.
Error
(
"unable to load the
new
certificate"
)
})
.
Error
(
"unable to load the
updated
certificate"
)
}
}
// step: load the new certificate
// step: load the new certificate
c
.
load
Certificate
(
certificate
)
c
.
store
Certificate
(
certificate
)
// step: print a debug message for us
// step: print a debug message for us
log
.
Infof
(
"replacing the server certifacte with updated version"
)
log
.
Infof
(
"replacing the server certifacte with updated version"
)
}
}
...
@@ -107,8 +100,8 @@ func (c *certificationRotation) watch() error {
...
@@ -107,8 +100,8 @@ func (c *certificationRotation) watch() error {
return
nil
return
nil
}
}
//
load
Certificate provides entrypoint to update the certificate
//
store
Certificate provides entrypoint to update the certificate
func
(
c
*
certificationRotation
)
load
Certificate
(
certifacte
tls
.
Certificate
)
error
{
func
(
c
*
certificationRotation
)
store
Certificate
(
certifacte
tls
.
Certificate
)
error
{
c
.
Lock
()
c
.
Lock
()
defer
c
.
Unlock
()
defer
c
.
Unlock
()
c
.
certificate
=
certifacte
c
.
certificate
=
certifacte
...
...
This diff is collapsed.
Click to expand it.
rotation_test.go
+
1
−
1
View file @
ff230d7d
...
@@ -62,7 +62,7 @@ func TestGetCertificate(t *testing.T) {
...
@@ -62,7 +62,7 @@ func TestGetCertificate(t *testing.T) {
func
TestLoadCertificate
(
t
*
testing
.
T
)
{
func
TestLoadCertificate
(
t
*
testing
.
T
)
{
c
:=
newTestCertificateRotator
(
t
)
c
:=
newTestCertificateRotator
(
t
)
assert
.
NotEmpty
(
t
,
c
.
certificate
)
assert
.
NotEmpty
(
t
,
c
.
certificate
)
c
.
load
Certificate
(
tls
.
Certificate
{})
c
.
store
Certificate
(
tls
.
Certificate
{})
crt
,
err
:=
c
.
GetCertificate
(
nil
)
crt
,
err
:=
c
.
GetCertificate
(
nil
)
assert
.
NoError
(
t
,
err
)
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
&
tls
.
Certificate
{},
crt
)
assert
.
Equal
(
t
,
&
tls
.
Certificate
{},
crt
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment