Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
koko
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
koko
Commits
17a481d4
Commit
17a481d4
authored
Apr 22, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改
parent
077c1b7f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
30 deletions
+8
-30
init.go
pkg/auth/init.go
+0
-22
accesskey.go
pkg/service/accesskey.go
+6
-6
client.go
pkg/service/client.go
+1
-1
users.go
pkg/service/users.go
+1
-1
No files found.
pkg/auth/init.go
deleted
100644 → 0
View file @
077c1b7f
package
auth
import
(
"cocogo/pkg/config"
)
var
appService
*
Service
func
Initial
()
{
conf
:=
config
.
GetGlobalConfig
()
appService
=
NewAuthService
(
conf
)
appService
.
LoadAccessKey
()
appService
.
EnsureValidAuth
()
appService
.
LoadTerminalConfig
()
}
func
GetGlobalService
()
*
Service
{
if
appService
==
nil
{
Initial
()
}
return
appService
}
pkg/service/accesskey.go
View file @
17a481d4
...
...
@@ -18,10 +18,10 @@ var (
)
type
AccessKey
struct
{
Id
string
Secret
string
Path
string
Context
string
Id
string
Secret
string
Path
string
Value
string
}
func
(
ak
AccessKey
)
Sign
()
string
{
...
...
@@ -35,7 +35,7 @@ func (ak *AccessKey) LoadAccessKeyFromStr(key string) error {
return
AccessKeyNotFound
}
keySlice
:=
strings
.
Split
(
strings
.
TrimSpace
(
key
),
":"
)
if
len
(
ak
.
Context
)
!=
2
{
if
len
(
ak
.
Value
)
!=
2
{
return
AccessKeyInvalid
}
ak
.
Id
=
keySlice
[
0
]
...
...
@@ -69,7 +69,7 @@ func (ak *AccessKey) Register(times int) error {
// LoadAccessKey 加载AccessKey用来与 Core Api 交互
func
(
ak
*
AccessKey
)
Load
()
(
err
error
)
{
err
=
ak
.
LoadAccessKeyFromStr
(
ak
.
Context
)
err
=
ak
.
LoadAccessKeyFromStr
(
ak
.
Value
)
if
err
==
nil
{
return
}
...
...
pkg/service/client.go
View file @
17a481d4
...
...
@@ -51,7 +51,7 @@ func (c *WrapperClient) LoadAuth() error {
if
!
path
.
IsAbs
(
config
.
Conf
.
AccessKeyFile
)
{
keyPath
=
filepath
.
Join
(
config
.
Conf
.
RootPath
,
keyPath
)
}
ak
:=
AccessKey
{
Context
:
config
.
Conf
.
AccessKey
,
Path
:
keyPath
}
ak
:=
AccessKey
{
Value
:
config
.
Conf
.
AccessKey
,
Path
:
keyPath
}
err
:=
ak
.
Load
()
if
err
!=
nil
{
return
err
...
...
pkg/service/users.go
View file @
17a481d4
...
...
@@ -53,7 +53,7 @@ package service
// return result.User, nil
//}
//
//func (s *Service) CheckSSHPassword(ctx ssh.
Context
, password string) bool {
//func (s *Service) CheckSSHPassword(ctx ssh.
Value
, password string) bool {
//
// username := ctx.User()
// remoteAddr := ctx.RemoteAddr().String()
...
...
Write
Preview
Markdown
is supported
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