Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cozy_oauth_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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
cozy_oauth_proxy
Commits
547bc672
Commit
547bc672
authored
4 years ago
by
Yoan VALLET
Browse files
Options
Downloads
Patches
Plain Diff
Parse params from body in grdf_token grdf
parent
4bf1feed
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#7982
failed
4 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.go
+19
-11
19 additions, 11 deletions
main.go
with
19 additions
and
11 deletions
main.go
+
19
−
11
View file @
547bc672
...
@@ -412,36 +412,44 @@ func main() {
...
@@ -412,36 +412,44 @@ func main() {
}
}
pageContent
:=
string
(
contents
)
pageContent
:=
string
(
contents
)
//Check for client_id
//Check for client_id
clientIdStartIndex
:=
strings
.
Index
(
pageContent
,
"client_id="
)
clientIdKey
:=
"client_id="
clientIdLength
:=
22
clientIdStartIndex
:=
strings
.
Index
(
pageContent
,
clientIdKey
)
if
clientIdStartIndex
==
-
1
{
if
clientIdStartIndex
==
-
1
{
log
.
Error
(
"No client_id found"
)
log
.
Error
(
"No client_id found"
)
http
.
Error
(
w
,
http
.
StatusText
(
500
),
500
)
http
.
Error
(
w
,
http
.
StatusText
(
500
),
500
)
}
}
clientIdStartIndex
+=
10
clientIdStartIndex
+=
len
(
clientIdKey
)
clientId
=
pageContent
[
clientIdStartIndex
:
clientIdStartIndex
+
36
]
clientId
=
pageContent
[
clientIdStartIndex
:
clientIdStartIndex
+
clientIdLength
]
//Check for client_secret
//Check for client_secret
clientSecretStartIndex
:=
strings
.
Index
(
pageContent
,
"client_secret="
)
clientSecretKey
:=
"client_secret="
clientSecretLength
:=
14
clientSecretStartIndex
:=
strings
.
Index
(
pageContent
,
clientSecretKey
)
if
clientSecretStartIndex
==
-
1
{
if
clientSecretStartIndex
==
-
1
{
log
.
Error
(
"No client_secret found"
)
log
.
Error
(
"No client_secret found"
)
http
.
Error
(
w
,
http
.
StatusText
(
500
),
500
)
http
.
Error
(
w
,
http
.
StatusText
(
500
),
500
)
}
}
clientSecretStartIndex
+=
14
clientSecretStartIndex
+=
len
(
clientSecretKey
)
clientSecret
=
pageContent
[
clientSecretStartIndex
:
clientSecretStartIndex
+
36
]
clientSecret
=
pageContent
[
clientSecretStartIndex
:
clientSecretStartIndex
+
clientSecretStartIndex
]
//Check for code
//Check for code
codeStartIndex
:=
strings
.
Index
(
pageContent
,
"code="
)
codeKey
:=
"code="
codeLength
:=
27
codeStartIndex
:=
strings
.
Index
(
pageContent
,
codeKey
)
if
codeStartIndex
==
-
1
{
if
codeStartIndex
==
-
1
{
log
.
Info
(
"No code found (optional param)"
)
log
.
Info
(
"No code found (optional param)"
)
}
else
{
}
else
{
codeStartIndex
+=
5
codeStartIndex
+=
len
(
codeKey
)
code
=
pageContent
[
codeStartIndex
:
codeStartIndex
+
30
]
code
=
pageContent
[
codeStartIndex
:
codeStartIndex
+
codeLength
]
}
}
//Check for grant_type
//Check for grant_type
grandTypeStartIndex
:=
strings
.
Index
(
pageContent
,
"grant_type="
)
grandTypeKey
:=
"grant_type="
grandTypeLength
:=
27
grandTypeStartIndex
:=
strings
.
Index
(
pageContent
,
grandTypeKey
)
if
grandTypeStartIndex
==
-
1
{
if
grandTypeStartIndex
==
-
1
{
log
.
Error
(
"No grant_type found"
)
log
.
Error
(
"No grant_type found"
)
http
.
Error
(
w
,
http
.
StatusText
(
500
),
500
)
http
.
Error
(
w
,
http
.
StatusText
(
500
),
500
)
}
}
grandTypeStartIndex
+=
11
grandTypeStartIndex
+=
len
(
grandTypeKey
)
tempGrandTypeString
:=
pageContent
[
grandTypeStartIndex
:
]
tempGrandTypeString
:=
pageContent
[
grandTypeStartIndex
:
]
grandTypeEndIndex
:=
strings
.
Index
(
tempGrandTypeString
,
"&"
)
grandTypeEndIndex
:=
strings
.
Index
(
tempGrandTypeString
,
"&"
)
if
grandTypeEndIndex
==
-
1
{
if
grandTypeEndIndex
==
-
1
{
...
...
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