Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
key-storage-agent
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Code
Merge requests
2
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
Show more breadcrumbs
Code
key-storage-agent
Merge requests
!35
supported key suspend
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
supported key suspend
235-device_management
into
master
Overview
3
Commits
2
Pipelines
0
Changes
2
1 unresolved thread
Hide all comments
Merged
Alexander Holodov
requested to merge
235-device_management
into
master
6 years ago
Overview
3
Commits
2
Pipelines
0
Changes
2
1 unresolved thread
Hide all comments
Expand
0
0
Merge request reports
Compare
master
version 1
01b7a91a
6 years ago
master (base)
and
latest version
latest version
8edc7bea
2 commits,
6 years ago
version 1
01b7a91a
1 commit,
6 years ago
2 files
+
49
−
21
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
handler/revoke.go
+
48
−
16
Options
@@ -27,40 +27,72 @@ import (
)
func
(
s
*
KeyStorageServerImpl
)
Revoke
(
ctx
context
.
Context
,
in
*
api
.
RevokeRequest
)
(
*
api
.
RevokeResponse
,
error
)
{
auth
:=
s
.
CreateAuthentication
(
ctx
)
client
:=
keyutils
.
CreateDataStorageClient
(
auth
)
defer
client
.
CloseClient
()
revokeResponse
:=
&
api
.
RevokeResponse
{}
revokeResponse
.
StatusList
=
revokeKey
(
client
,
in
.
Uuid
,
api
.
KeyType_PRIVATE
)
revokeResponse
.
StatusList
=
s
.
updateAll
(
ctx
,
in
.
Uuid
,
func
(
k
*
api
.
Key
)
{
k
.
Revoked
=
true
}
)
if
revokeResponse
.
StatusList
!=
nil
{
return
revokeResponse
,
nil
}
revokeResponse
.
StatusList
=
utils
.
AddStatus
(
revokeResponse
.
StatusList
,
"200"
,
api
.
StatusType_INFO
,
"Keys revoked"
)
return
revokeResponse
,
nil
}
revokeResponse
.
StatusList
=
revokeKey
(
client
,
in
.
Uuid
,
api
.
KeyType_PUBLIC
)
if
revokeResponse
.
StatusList
!=
nil
{
return
revokeResponse
,
nil
func
(
s
*
KeyStorageServerImpl
)
Suspend
(
ctx
context
.
Context
,
in
*
api
.
SuspendRequest
)
(
*
api
.
SuspendResponse
,
error
)
{
suspendResponse
:=
&
api
.
SuspendResponse
{}
suspendResponse
.
StatusList
=
s
.
updateAll
(
ctx
,
in
.
Uuid
,
func
(
k
*
api
.
Key
)
{
k
.
Suspended
=
true
})
if
suspendResponse
.
StatusList
!=
nil
{
return
suspendResponse
,
nil
}
suspendResponse
.
StatusList
=
utils
.
AddStatus
(
suspendResponse
.
StatusList
,
"200"
,
api
.
StatusType_INFO
,
"Keys suspended"
)
return
suspendResponse
,
nil
}
revokeResponse
.
StatusList
=
revokeKey
(
client
,
in
.
Uuid
,
api
.
KeyType_CERTIFICATE
)
if
revokeResponse
.
StatusList
!=
nil
{
return
revokeResponse
,
nil
func
(
s
*
KeyStorageServerImpl
)
Resume
(
ctx
context
.
Context
,
in
*
api
.
ResumeRequest
)
(
*
api
.
ResumeResponse
,
error
)
{
resumeResponse
:=
&
api
.
ResumeResponse
{}
resumeResponse
.
StatusList
=
s
.
updateAll
(
ctx
,
in
.
Uuid
,
func
(
k
*
api
.
Key
)
{
k
.
Suspended
=
false
})
if
resumeResponse
.
StatusList
!=
nil
{
return
resumeResponse
,
nil
}
resumeResponse
.
StatusList
=
utils
.
AddStatus
(
resumeResponse
.
StatusList
,
"200"
,
api
.
StatusType_INFO
,
"Keys resumed"
)
return
resumeResponse
,
nil
}
revokeResponse
.
StatusList
=
utils
.
AddStatus
(
revokeResponse
.
StatusList
,
"200"
,
api
.
StatusType_INFO
,
"Keys revoked"
)
return
revokeResponse
,
nil
func
(
s
*
KeyStorageServerImpl
)
Rename
(
ctx
context
.
Context
,
in
*
api
.
RenameRequest
)
(
*
api
.
RenameResponse
,
error
)
{
renameResponse
:=
&
api
.
RenameResponse
{}
renameResponse
.
StatusList
=
s
.
updateAll
(
ctx
,
in
.
Uuid
,
func
(
k
*
api
.
Key
)
{
k
.
Name
=
in
.
Name
})
if
renameResponse
.
StatusList
!=
nil
{
return
renameResponse
,
nil
}
renameResponse
.
StatusList
=
utils
.
AddStatus
(
renameResponse
.
StatusList
,
"200"
,
api
.
StatusType_INFO
,
"Keys renamed"
)
return
renameResponse
,
nil
}
func
revokeKey
(
client
*
client
.
DataStorageClientImpl
,
uuid
string
,
keyType
api
.
KeyType
)
[]
*
api
.
Status
{
func
(
s
*
KeyStorageServerImpl
)
updateAll
(
ctx
context
.
Context
,
uuid
string
,
update
func
(
*
api
.
Key
))
[]
*
api
.
Status
{
auth
:=
s
.
CreateAuthentication
(
ctx
)
client
:=
keyutils
.
CreateDataStorageClient
(
auth
)
defer
client
.
CloseClient
()
for
_
,
kType
:=
range
[]
api
.
KeyType
{
api
.
KeyType_PRIVATE
,
api
.
KeyType_PUBLIC
,
api
.
KeyType_CERTIFICATE
}
{
statusList
:=
updateKey
(
client
,
uuid
,
kType
,
update
)
if
statusList
!=
nil
{
return
statusList
}
}
return
nil
}
func
updateKey
(
client
*
client
.
DataStorageClientImpl
,
uuid
string
,
keyType
api
.
KeyType
,
update
func
(
*
api
.
Key
))
[]
*
api
.
Status
{
key
,
statusList
:=
keyutils
.
GetKey
(
client
,
uuid
,
keyType
)
if
statusList
!=
nil
{
return
statusList
}
key
.
Revoked
=
true
update
(
key
)
_
,
errors
,
err
:=
client
.
DoPutDataCall
(
"keys"
,
uuid
+
"/"
+
api
.
KeyType
.
String
(
keyType
),
key
,
versions
.
EntitiesManagementAgentApiVersion
)
statusList
=
keyutils
.
HandlePutDataErrors
(
statusList
,
errors
,
err
)
Loading