Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Kplcloud
Commits
63aab897
Commit
63aab897
authored
4 years ago
by
icowan
Browse files
Options
Download
Email Patches
Plain Diff
代理问题
parent
e648f737
master
kplcloud-v1
revert-33-v2
v2
v0.2.9
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+1
-1
Makefile
src/pkg/auth/service.go
+18
-19
src/pkg/auth/service.go
with
19 additions
and
20 deletions
+19
-20
Makefile
+
1
-
1
View file @
63aab897
...
@@ -12,7 +12,7 @@ PID = .pid
...
@@ -12,7 +12,7 @@ PID = .pid
HUB_ADDR
=
HUB_ADDR
=
DOCKER_USER
=
hub.docker.com
DOCKER_USER
=
hub.docker.com
DOCKER_PWD
=
DOCKER_PWD
=
TAG
=
v0.2.
8
TAG
=
v0.2.
9
NAMESPACE
=
kplcloud
NAMESPACE
=
kplcloud
PWD
=
$(
shell
pwd
)
PWD
=
$(
shell
pwd
)
...
...
This diff is collapsed.
Click to expand it.
src/pkg/auth/service.go
+
18
-
19
View file @
63aab897
...
@@ -108,6 +108,24 @@ func (c *service) AuthLoginGithubCallback(w http.ResponseWriter, r *http.Request
...
@@ -108,6 +108,24 @@ func (c *service) AuthLoginGithubCallback(w http.ResponseWriter, r *http.Request
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
// state := r.URL.Query().Get("state") // todo 它需要验证一下可以考虑使用jwt生成 先用cookie 简单处理一下吧...
// state := r.URL.Query().Get("state") // todo 它需要验证一下可以考虑使用jwt生成 先用cookie 简单处理一下吧...
if
httpProxy
:=
c
.
config
.
GetString
(
config
.
SectionServer
,
"http_proxy"
);
httpProxy
!=
""
{
_
=
level
.
Debug
(
c
.
logger
)
.
Log
(
"use-proxy"
,
httpProxy
)
dialer
:=
&
net
.
Dialer
{
Timeout
:
time
.
Duration
(
5
*
int64
(
time
.
Second
)),
KeepAlive
:
time
.
Duration
(
5
*
int64
(
time
.
Second
)),
}
ctx
=
context
.
WithValue
(
ctx
,
oauth2
.
HTTPClient
,
&
http
.
Client
{
Transport
:
&
http
.
Transport
{
Proxy
:
func
(
_
*
http
.
Request
)
(
*
url
.
URL
,
error
)
{
return
url
.
Parse
(
httpProxy
)
},
DialContext
:
dialer
.
DialContext
,
TLSClientConfig
:
&
tls
.
Config
{
InsecureSkipVerify
:
false
,
},
},
})
}
githubOauthConfig
:=
c
.
auth2Config
()
githubOauthConfig
:=
c
.
auth2Config
()
...
@@ -135,25 +153,6 @@ func (c *service) AuthLoginGithubCallback(w http.ResponseWriter, r *http.Request
...
@@ -135,25 +153,6 @@ func (c *service) AuthLoginGithubCallback(w http.ResponseWriter, r *http.Request
return
return
}
}
if
httpProxy
:=
c
.
config
.
GetString
(
config
.
SectionServer
,
"http_proxy"
);
httpProxy
!=
""
{
_
=
level
.
Debug
(
c
.
logger
)
.
Log
(
"use-proxy"
,
httpProxy
)
dialer
:=
&
net
.
Dialer
{
Timeout
:
time
.
Duration
(
5
*
int64
(
time
.
Second
)),
KeepAlive
:
time
.
Duration
(
5
*
int64
(
time
.
Second
)),
}
ctx
=
context
.
WithValue
(
ctx
,
oauth2
.
HTTPClient
,
&
http
.
Client
{
Transport
:
&
http
.
Transport
{
Proxy
:
func
(
_
*
http
.
Request
)
(
*
url
.
URL
,
error
)
{
return
url
.
Parse
(
httpProxy
)
},
DialContext
:
dialer
.
DialContext
,
TLSClientConfig
:
&
tls
.
Config
{
InsecureSkipVerify
:
false
,
},
},
})
}
client
:=
github
.
NewClient
(
githubOauthConfig
.
Client
(
ctx
,
token
))
client
:=
github
.
NewClient
(
githubOauthConfig
.
Client
(
ctx
,
token
))
user
,
_
,
err
:=
client
.
Users
.
Get
(
context
.
Background
(),
""
)
user
,
_
,
err
:=
client
.
Users
.
Get
(
context
.
Background
(),
""
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help