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
47b7398a
Commit
47b7398a
authored
Apr 30, 2017
by
Rohith Jayawardene
Committed by
Rohith
May 19, 2017
Browse files
Options
Downloads
Patches
Plain Diff
Base64 Encoding (#226)
- reverting back to the base64 encoding due to header size considerations
parent
0ad1a3e6
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
utils.go
+4
-4
4 additions, 4 deletions
utils.go
utils_test.go
+1
-1
1 addition, 1 deletion
utils_test.go
with
5 additions
and
5 deletions
utils.go
+
4
−
4
View file @
47b7398a
...
@@ -22,7 +22,7 @@ import (
...
@@ -22,7 +22,7 @@ import (
"crypto/rand"
"crypto/rand"
"crypto/tls"
"crypto/tls"
"crypto/x509"
"crypto/x509"
"encoding/
hex
"
"encoding/
base64
"
"encoding/json"
"encoding/json"
"errors"
"errors"
"fmt"
"fmt"
...
@@ -126,12 +126,12 @@ func encodeText(plaintext string, key string) (string, error) {
...
@@ -126,12 +126,12 @@ func encodeText(plaintext string, key string) (string, error) {
return
""
,
err
return
""
,
err
}
}
return
hex
.
EncodeToString
(
cipherText
),
nil
return
base64
.
RawStdEncoding
.
EncodeToString
(
cipherText
),
nil
}
}
// decodeText decodes the session state cookie value
// decodeText decodes the session state cookie value
func
decodeText
(
state
,
key
string
)
(
string
,
error
)
{
func
decodeText
(
state
,
key
string
)
(
string
,
error
)
{
cipherText
,
err
:=
hex
.
DecodeString
(
state
)
cipherText
,
err
:=
base64
.
RawStdEncoding
.
DecodeString
(
state
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
@@ -434,7 +434,7 @@ func getWithin(expires time.Time, within float64) time.Duration {
...
@@ -434,7 +434,7 @@ func getWithin(expires time.Time, within float64) time.Duration {
// getHashKey returns a hash of the encodes jwt token
// getHashKey returns a hash of the encodes jwt token
func
getHashKey
(
token
*
jose
.
JWT
)
string
{
func
getHashKey
(
token
*
jose
.
JWT
)
string
{
hash
:=
md5
.
Sum
([]
byte
(
token
.
Encode
()))
hash
:=
md5
.
Sum
([]
byte
(
token
.
Encode
()))
return
hex
.
EncodeToString
(
hash
[
:
])
return
base64
.
RawStdEncoding
.
EncodeToString
(
hash
[
:
])
}
}
// printError display the command line usage and error
// printError display the command line usage and error
...
...
This diff is collapsed.
Click to expand it.
utils_test.go
+
1
−
1
View file @
47b7398a
...
@@ -135,7 +135,7 @@ var (
...
@@ -135,7 +135,7 @@ var (
JxkaNpboZ6hnrMytlw5kf0biF7dLTU885uHIGkUIRy75hx6BaTEEhbN36qVTxediEHd6xeBPS3qpJ7riO6J
JxkaNpboZ6hnrMytlw5kf0biF7dLTU885uHIGkUIRy75hx6BaTEEhbN36qVTxediEHd6xeBPS3qpJ7riO6J
EeaQr1rroDL0LvmDyB6Zds4LdVQEmtUueusc7jkBz7gJ12vnTHIxviZM5rzcq4tyCbZO7Kb37RqZg5kbYGK
EeaQr1rroDL0LvmDyB6Zds4LdVQEmtUueusc7jkBz7gJ12vnTHIxviZM5rzcq4tyCbZO7Kb37RqZg5kbYGK
PfErhUwUIin7jsNVE7coB`
)
PfErhUwUIin7jsNVE7coB`
)
fakeCipherText
=
[]
byte
(
"
149e576b52d64bea996e161e4ad0079a95923ee945e93bfe29a5dd3ced347b3c14ea0d58c0d02a5d503cf36cdbf959af4d04e654c8d46c4367903c785867097ea08185602544c6daac59fd8a8a44d83afecc71a1d4ead199bb64bd276f24552c9001fc76113d4ed9838eba6728e0b0e31444a47157d02f40a9ae708ad2f10c271454dcedbecc1455357826962115e88c8230a44bd81d264a3e6e1cf7d0221faa2076f934c1e26f50e6edfbb3c16bc51f826d53cc01e40a755c546df918714cef9743d4ff6355937ee1214eef7925dc204165feb1ee0a926294bf91ed2c54a6ac4764d68b332896bc70379b69029a22966ee0e535a496c4f8eef8399ad4f7011a1b98cd45deed134d791185e5b9f2dccfbd14da3eb618bef4dba52590e96ceb3e9e39
"
)
fakeCipherText
=
[]
byte
(
"
lfQPTa6jwMTABaJhcrfVkoqcdyMVAettMsqgKXIALSKG5UpoYKbT/WgZjOiuCmEI0E/7piP8VATLOAHKDBNF2WrQOKSYF+gdHkh4NLv0cW0NZ2qyZeWhknywE6063ylhCYjJOrJA1z12i2bHHbjZZGfqkwfzyxxFLTv6jSbalpZ4oZcUcNY/DrtVk/K01qZw6o4l1f0FUL6UZVSirn+B3YDWLeVQ0FGr6jlhCpN203Rf688nqdBvhw4bUEQiykCMxWm2/rJBNWm2SzZgw65kb4W0ph1qjcoUjXBwNakK+E0Lw/fwi8+bUC1lkT8+hJpMLKZkzb07rbGAnmljQo0NkqJh4kl+aycsEhm9bZj+b6w0r795YugyNsyca5CnUvkB1Dg
"
)
fakeKey
=
[]
byte
(
"u3K0eKsmGl76jY1buzexwYoRRLLQrQck"
)
fakeKey
=
[]
byte
(
"u3K0eKsmGl76jY1buzexwYoRRLLQrQck"
)
)
)
...
...
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