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
Commits
32acc6b4
Commit
32acc6b4
authored
5 years ago
by
Gospodin Bodurov
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Add activity delta modifications"
This reverts commit
162557a0
parent
162557a0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!40
Revert "Add activity delta modifications"
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Gopkg.toml
+1
-1
1 addition, 1 deletion
Gopkg.toml
config/configs.go
+0
-3
0 additions, 3 deletions
config/configs.go
handler/handler.go
+0
-80
0 additions, 80 deletions
handler/handler.go
utils/utils.go
+0
-6
0 additions, 6 deletions
utils/utils.go
with
1 addition
and
90 deletions
Gopkg.toml
+
1
−
1
View file @
32acc6b4
[[constraint]]
[[constraint]]
branch
=
"
activity_upda
te"
branch
=
"
mas
te
r
"
name
=
"code.vereign.com/code/viam-apis"
name
=
"code.vereign.com/code/viam-apis"
[[constraint]]
[[constraint]]
...
...
This diff is collapsed.
Click to expand it.
config/configs.go
+
0
−
3
View file @
32acc6b4
...
@@ -25,7 +25,6 @@ var MaxMessageSize int
...
@@ -25,7 +25,6 @@ var MaxMessageSize int
var
GrpcListenAddress
string
var
GrpcListenAddress
string
var
RestListenAddress
string
var
RestListenAddress
string
var
DataStorageUrl
string
var
DataStorageUrl
string
var
EntitiesManagerUrl
string
var
CertDir
string
var
CertDir
string
func
SetConfigValues
()
{
func
SetConfigValues
()
{
...
@@ -35,7 +34,6 @@ func SetConfigValues() {
...
@@ -35,7 +34,6 @@ func SetConfigValues() {
viper
.
SetDefault
(
"grpcListenAddress"
,
"localhost:7877"
)
viper
.
SetDefault
(
"grpcListenAddress"
,
"localhost:7877"
)
viper
.
SetDefault
(
"restListenAddress"
,
"localhost:7878"
)
viper
.
SetDefault
(
"restListenAddress"
,
"localhost:7878"
)
viper
.
SetDefault
(
"dataStorageUrl"
,
"localhost:7777"
)
viper
.
SetDefault
(
"dataStorageUrl"
,
"localhost:7777"
)
viper
.
SetDefault
(
"entitiesManagerUrl"
,
"localhost:7779"
)
viper
.
SetDefault
(
"viamUUID"
,
"viam-system"
)
viper
.
SetDefault
(
"viamUUID"
,
"viam-system"
)
viper
.
SetDefault
(
"viamSession"
,
"viam-session"
)
viper
.
SetDefault
(
"viamSession"
,
"viam-session"
)
...
@@ -108,7 +106,6 @@ func SetConfigValues() {
...
@@ -108,7 +106,6 @@ func SetConfigValues() {
RestListenAddress
=
viper
.
GetString
(
"restListenAddress"
)
RestListenAddress
=
viper
.
GetString
(
"restListenAddress"
)
DataStorageUrl
=
viper
.
GetString
(
"dataStorageUrl"
)
DataStorageUrl
=
viper
.
GetString
(
"dataStorageUrl"
)
EntitiesManagerUrl
=
viper
.
GetString
(
"entitiesManagerUrl"
)
SystemAuth
.
Uuid
=
viper
.
GetString
(
"viamUUID"
)
SystemAuth
.
Uuid
=
viper
.
GetString
(
"viamUUID"
)
SystemAuth
.
Session
=
viper
.
GetString
(
"viamSession"
)
SystemAuth
.
Session
=
viper
.
GetString
(
"viamSession"
)
...
...
This diff is collapsed.
Click to expand it.
handler/handler.go
+
0
−
80
View file @
32acc6b4
...
@@ -18,12 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
...
@@ -18,12 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package
handler
package
handler
import
(
import
(
"encoding/base64"
"errors"
"log"
"log"
"strings"
"strings"
"code.vereign.com/code/viam-apis/clientutils"
"code.vereign.com/code/viam-apis/versions"
"code.vereign.com/code/viam-apis/versions"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/proto"
...
@@ -35,10 +32,6 @@ import (
...
@@ -35,10 +32,6 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/metadata"
)
)
const
(
keyToKeyIdTable
=
"authenticationKeyToKeyId"
)
// Server represents the gRPC server
// Server represents the gRPC server
type
KeyStorageServerImpl
struct
{
type
KeyStorageServerImpl
struct
{
DataStorageUrl
string
DataStorageUrl
string
...
@@ -172,17 +165,6 @@ func (s *KeyStorageServerImpl) SetKey(ctx context.Context, in *api.SetKeyRequest
...
@@ -172,17 +165,6 @@ func (s *KeyStorageServerImpl) SetKey(ctx context.Context, in *api.SetKeyRequest
"200"
,
api
.
StatusType_INFO
,
result
)
"200"
,
api
.
StatusType_INFO
,
result
)
}
}
if
in
.
KeyType
==
api
.
KeyType_PUBLIC
{
keyContent
:=
base64
.
StdEncoding
.
EncodeToString
(
in
.
Key
.
Content
)
_
,
_
,
err
=
client
.
DoPutDataCallWithString
(
keyToKeyIdTable
,
keyContent
,
in
.
Uuid
,
versions
.
EntitiesManagementAgentApiVersion
)
if
err
!=
nil
{
log
.
Printf
(
"can't DoPutDataCallWithString: %s"
,
err
)
return
nil
,
err
}
}
return
setKeyResponse
,
nil
return
setKeyResponse
,
nil
}
}
...
@@ -227,68 +209,6 @@ func (s *KeyStorageServerImpl) ReserveKeyUUID(ctx context.Context, in *api.Reser
...
@@ -227,68 +209,6 @@ func (s *KeyStorageServerImpl) ReserveKeyUUID(ctx context.Context, in *api.Reser
return
reserveKeyUUIDResponse
,
nil
return
reserveKeyUUIDResponse
,
nil
}
}
func
(
s
*
KeyStorageServerImpl
)
GetKeyId
(
ctx
context
.
Context
,
in
*
api
.
GetKeyIdByKeyRequest
)
(
*
api
.
GetKeyIdByKeyResponse
,
error
)
{
auth
:=
s
.
CreateAuthentication
(
ctx
)
//in.PublicKey
entitiesMagamentClient
:=
keyutils
.
CreateEntitiesManagementClient
(
auth
)
defer
entitiesMagamentClient
.
CloseClient
()
dataStorageClient
:=
keyutils
.
CreateDataStorageClient
(
auth
)
defer
dataStorageClient
.
CloseClient
()
keyIdResponse
:=
&
api
.
GetKeyIdByKeyResponse
{}
response
,
err
:=
dataStorageClient
.
DoGetDataCall
(
keyToKeyIdTable
,
in
.
PublicKey
)
if
err
==
nil
&&
response
.
Data
!=
nil
&&
response
.
Data
.
Data
!=
nil
{
keyID
:=
string
(
response
.
Data
.
Data
)
keyIdResponse
.
KeyId
=
keyID
return
keyIdResponse
,
nil
}
entity
,
err
:=
clientutils
.
GetLastEntity
(
entitiesMagamentClient
,
auth
.
Uuid
)
if
err
!=
nil
{
return
nil
,
err
}
for
_
,
checkID
:=
range
entity
.
AuthenticationKeys
{
key
:=
&
api
.
Key
{}
data
,
err
:=
dataStorageClient
.
DoGetDataCall
(
"keys"
,
checkID
+
"/"
+
api
.
KeyType_PUBLIC
.
String
())
if
err
!=
nil
{
log
.
Printf
(
"grpc call GetKeyId to DataStorage failed: %s"
,
err
)
return
nil
,
err
}
if
data
.
Errors
!=
""
{
return
nil
,
errors
.
New
(
data
.
Errors
)
}
else
{
proto
.
Unmarshal
(
data
.
Data
.
Data
,
key
)
}
keyFromStorage
:=
base64
.
StdEncoding
.
EncodeToString
(
key
.
Content
)
if
in
.
PublicKey
!=
keyFromStorage
{
continue
}
_
,
_
,
err
=
dataStorageClient
.
DoPutDataCallWithString
(
keyToKeyIdTable
,
in
.
PublicKey
,
checkID
,
versions
.
EntitiesManagementAgentApiVersion
)
if
err
!=
nil
{
log
.
Printf
(
"can't DoPutDataCallWithString: %s"
,
err
)
return
nil
,
err
}
keyIdResponse
.
KeyId
=
checkID
return
keyIdResponse
,
nil
}
//getKeyFromContent
return
keyIdResponse
,
nil
}
func
(
s
*
KeyStorageServerImpl
)
GetVersionKSA
(
ctx
context
.
Context
,
in
*
api
.
GetVersionKSAMessage
)
(
*
api
.
GetVersionKSAResponseMessage
,
error
)
{
func
(
s
*
KeyStorageServerImpl
)
GetVersionKSA
(
ctx
context
.
Context
,
in
*
api
.
GetVersionKSAMessage
)
(
*
api
.
GetVersionKSAResponseMessage
,
error
)
{
log
.
Println
(
"Version: "
+
version
)
log
.
Println
(
"Version: "
+
version
)
return
&
api
.
GetVersionKSAResponseMessage
{
Version
:
version
,
Errors
:
""
},
nil
return
&
api
.
GetVersionKSAResponseMessage
{
Version
:
version
,
Errors
:
""
},
nil
...
...
This diff is collapsed.
Click to expand it.
utils/utils.go
+
0
−
6
View file @
32acc6b4
...
@@ -33,7 +33,6 @@ import (
...
@@ -33,7 +33,6 @@ import (
"code.vereign.com/code/viam-apis/clientutils"
"code.vereign.com/code/viam-apis/clientutils"
"code.vereign.com/code/viam-apis/data-storage-agent/client"
"code.vereign.com/code/viam-apis/data-storage-agent/client"
dsclient
"code.vereign.com/code/viam-apis/data-storage-agent/client"
dsclient
"code.vereign.com/code/viam-apis/data-storage-agent/client"
emclient
"code.vereign.com/code/viam-apis/entities-management-agent/client"
"code.vereign.com/code/viam-apis/key-storage-agent/api"
"code.vereign.com/code/viam-apis/key-storage-agent/api"
"code.vereign.com/code/viam-apis/utils"
"code.vereign.com/code/viam-apis/utils"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/proto"
...
@@ -152,8 +151,3 @@ func CreateDataStorageClient(auth *authentication.Authentication) *dsclient.Data
...
@@ -152,8 +151,3 @@ func CreateDataStorageClient(auth *authentication.Authentication) *dsclient.Data
return
clientutils
.
CreateDataStorageClient
(
auth
,
config
.
DataStorageUrl
,
config
.
CertificatePEM
,
return
clientutils
.
CreateDataStorageClient
(
auth
,
config
.
DataStorageUrl
,
config
.
CertificatePEM
,
config
.
PrivateKeyPEM
,
config
.
CaCertificatePEM
,
config
.
MaxMessageSize
)
config
.
PrivateKeyPEM
,
config
.
CaCertificatePEM
,
config
.
MaxMessageSize
)
}
}
func
CreateEntitiesManagementClient
(
auth
*
authentication
.
Authentication
)
*
emclient
.
EntitiesManagerClientImpl
{
return
clientutils
.
CreateEntitiesManagementClient
(
auth
,
config
.
EntitiesManagerUrl
,
config
.
CertificatePEM
,
config
.
PrivateKeyPEM
,
config
.
CaCertificatePEM
,
config
.
MaxMessageSize
)
}
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