@ -3085,6 +3085,7 @@ func TestAddTargetCredentialSources(t *testing.T) {
storeStatic := credstatic . TestCredentialStore ( t , conn , wrapper , proj . GetPublicId ( ) )
creds := credstatic . TestUsernamePasswordCredentials ( t , conn , wrapper , "user" , "pass" , storeStatic . GetPublicId ( ) , proj . GetPublicId ( ) , 2 )
updCreds := credstatic . TestUsernamePasswordDomainCredentials ( t , conn , wrapper , "user" , "pass" , "domain" , storeStatic . GetPublicId ( ) , proj . GetPublicId ( ) , 2 )
pCreds := credstatic . TestPasswordCredentials ( t , conn , wrapper , "pass" , storeStatic . GetPublicId ( ) , proj . GetPublicId ( ) , 2 )
addCases := [ ] struct {
name string
@ -3110,6 +3111,12 @@ func TestAddTargetCredentialSources(t *testing.T) {
addSources : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
resultSourceIds : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Add static p cred on empty target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "empty for static_p sources" ) ,
addSources : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
resultSourceIds : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Add library on library populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated for lib-lib sources" , target . WithCredentialLibraries ( [ ] * target . CredentialLibrary { target . TestNewCredentialLibrary ( "" , cls [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose , string ( cls [ 0 ] . CredentialType ( ) ) ) } ) ) ,
@ -3128,6 +3135,12 @@ func TestAddTargetCredentialSources(t *testing.T) {
addSources : [ ] string { cls [ 1 ] . GetPublicId ( ) } ,
resultSourceIds : [ ] string { updCreds [ 0 ] . GetPublicId ( ) , cls [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Add library on static p cred populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated for lib-static_p sources" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , pCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
addSources : [ ] string { cls [ 1 ] . GetPublicId ( ) } ,
resultSourceIds : [ ] string { pCreds [ 0 ] . GetPublicId ( ) , cls [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Add static cred on library populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated for static-lib sources" , target . WithCredentialLibraries ( [ ] * target . CredentialLibrary { target . TestNewCredentialLibrary ( "" , cls [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose , string ( cls [ 0 ] . CredentialType ( ) ) ) } ) ) ,
@ -3140,6 +3153,12 @@ func TestAddTargetCredentialSources(t *testing.T) {
addSources : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
resultSourceIds : [ ] string { cls [ 0 ] . GetPublicId ( ) , updCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Add p static cred on library populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated for static_p-lib sources" , target . WithCredentialLibraries ( [ ] * target . CredentialLibrary { target . TestNewCredentialLibrary ( "" , cls [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose , string ( cls [ 0 ] . CredentialType ( ) ) ) } ) ) ,
addSources : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
resultSourceIds : [ ] string { cls [ 0 ] . GetPublicId ( ) , pCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Add static cred on static cred populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated for static-static sources" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , creds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
@ -3152,6 +3171,12 @@ func TestAddTargetCredentialSources(t *testing.T) {
addSources : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
resultSourceIds : [ ] string { creds [ 0 ] . GetPublicId ( ) , updCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Add static p cred on static cred populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated for static_p-static sources" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , creds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
addSources : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
resultSourceIds : [ ] string { creds [ 0 ] . GetPublicId ( ) , pCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Add duplicated sources on library populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "duplicated for lib sources" , target . WithCredentialLibraries ( [ ] * target . CredentialLibrary { target . TestNewCredentialLibrary ( "" , cls [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose , string ( cls [ 0 ] . CredentialType ( ) ) ) } ) ) ,
@ -3170,6 +3195,12 @@ func TestAddTargetCredentialSources(t *testing.T) {
addSources : [ ] string { cls [ 1 ] . GetPublicId ( ) , cls [ 1 ] . GetPublicId ( ) , updCreds [ 1 ] . GetPublicId ( ) , updCreds [ 1 ] . GetPublicId ( ) } ,
resultSourceIds : [ ] string { updCreds [ 0 ] . GetPublicId ( ) , cls [ 1 ] . GetPublicId ( ) , updCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Add duplicated sources on static p cred populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "duplicated for static p sources" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , pCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
addSources : [ ] string { cls [ 1 ] . GetPublicId ( ) , cls [ 1 ] . GetPublicId ( ) , pCreds [ 1 ] . GetPublicId ( ) , pCreds [ 1 ] . GetPublicId ( ) } ,
resultSourceIds : [ ] string { pCreds [ 0 ] . GetPublicId ( ) , cls [ 1 ] . GetPublicId ( ) , pCreds [ 1 ] . GetPublicId ( ) } ,
} ,
}
for _ , tc := range addCases {
@ -3296,6 +3327,7 @@ func TestSetTargetCredentialSources(t *testing.T) {
storeStatic := credstatic . TestCredentialStore ( t , conn , wrapper , proj . GetPublicId ( ) )
creds := credstatic . TestUsernamePasswordCredentials ( t , conn , wrapper , "user" , "pass" , storeStatic . GetPublicId ( ) , proj . GetPublicId ( ) , 2 )
updCreds := credstatic . TestUsernamePasswordDomainCredentials ( t , conn , wrapper , "user" , "pass" , "domain" , storeStatic . GetPublicId ( ) , proj . GetPublicId ( ) , 2 )
pCreds := credstatic . TestPasswordCredentials ( t , conn , wrapper , "pass" , storeStatic . GetPublicId ( ) , proj . GetPublicId ( ) , 2 )
setCases := [ ] struct {
name string
@ -3321,6 +3353,12 @@ func TestSetTargetCredentialSources(t *testing.T) {
setCredentialSources : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set static_p on empty target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "empty static_p" ) ,
setCredentialSources : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set library on library populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated library-library" , target . WithCredentialLibraries ( [ ] * target . CredentialLibrary { target . TestNewCredentialLibrary ( "" , cls [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose , string ( cls [ 0 ] . CredentialType ( ) ) ) } ) ) ,
@ -3339,6 +3377,12 @@ func TestSetTargetCredentialSources(t *testing.T) {
setCredentialSources : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set static_p on library populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated static_p-library" , target . WithCredentialLibraries ( [ ] * target . CredentialLibrary { target . TestNewCredentialLibrary ( "" , cls [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose , string ( cls [ 0 ] . CredentialType ( ) ) ) } ) ) ,
setCredentialSources : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set library on static populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated library-static" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , creds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
@ -3351,6 +3395,12 @@ func TestSetTargetCredentialSources(t *testing.T) {
setCredentialSources : [ ] string { cls [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { cls [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set library on static_p populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated library-static_p" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , pCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
setCredentialSources : [ ] string { cls [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { cls [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set static on static populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated static-static" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , creds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
@ -3363,12 +3413,24 @@ func TestSetTargetCredentialSources(t *testing.T) {
setCredentialSources : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set static_p on static populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated static_p-static" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , creds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
setCredentialSources : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set static on static_upd populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated static-static_upd" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , updCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
setCredentialSources : [ ] string { creds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { creds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set static on static_p populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "populated static-static_p" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , pCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
setCredentialSources : [ ] string { creds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { creds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set duplicate library on populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "duplicate library" , target . WithCredentialLibraries ( [ ] * target . CredentialLibrary { target . TestNewCredentialLibrary ( "" , cls [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose , string ( cls [ 0 ] . CredentialType ( ) ) ) } ) ) ,
@ -3387,12 +3449,19 @@ func TestSetTargetCredentialSources(t *testing.T) {
setCredentialSources : [ ] string { updCreds [ 1 ] . GetPublicId ( ) , updCreds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set duplicate static_p on populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "duplicate static_p" , target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , pCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ) ,
setCredentialSources : [ ] string { pCreds [ 1 ] . GetPublicId ( ) , pCreds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
} ,
{
name : "Set empty on populated target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "another populated" ,
target . WithCredentialLibraries ( [ ] * target . CredentialLibrary { target . TestNewCredentialLibrary ( "" , cls [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose , string ( cls [ 0 ] . CredentialType ( ) ) ) } ) ,
target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , creds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ,
target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , updCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ,
target . WithStaticCredentials ( [ ] * target . StaticCredential { target . TestNewStaticCredential ( "" , pCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) } ) ,
) ,
setCredentialSources : [ ] string { } ,
resultCredentialSourceIds : nil ,
@ -3509,6 +3578,7 @@ func TestRemoveTargetCredentialSources(t *testing.T) {
csStatic := credstatic . TestCredentialStores ( t , conn , wrapper , proj . GetPublicId ( ) , 1 ) [ 0 ]
creds := credstatic . TestUsernamePasswordCredentials ( t , conn , wrapper , "u" , "p" , csStatic . GetPublicId ( ) , proj . GetPublicId ( ) , 2 )
updCreds := credstatic . TestUsernamePasswordDomainCredentials ( t , conn , wrapper , "user" , "pass" , "domain" , csStatic . GetPublicId ( ) , proj . GetPublicId ( ) , 2 )
pCreds := credstatic . TestPasswordCredentials ( t , conn , wrapper , "pass" , csStatic . GetPublicId ( ) , proj . GetPublicId ( ) , 2 )
removeCases := [ ] struct {
name string
@ -3535,6 +3605,12 @@ func TestRemoveTargetCredentialSources(t *testing.T) {
removeCredentialSources : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
wantErr : true ,
} ,
{
name : "Remove static_p from empty" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "empty static_p" ) ,
removeCredentialSources : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
wantErr : true ,
} ,
{
name : "Remove 1 of 2 libraries" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "remove partial lib" ,
@ -3565,6 +3641,16 @@ func TestRemoveTargetCredentialSources(t *testing.T) {
removeCredentialSources : [ ] string { updCreds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { updCreds [ 0 ] . GetPublicId ( ) } ,
} ,
{
name : "Remove 1 of 2 static_p credentials" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "remove partial static_p" ,
target . WithStaticCredentials ( [ ] * target . StaticCredential {
target . TestNewStaticCredential ( "" , pCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
target . TestNewStaticCredential ( "" , pCreds [ 1 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
} ) ) ,
removeCredentialSources : [ ] string { pCreds [ 1 ] . GetPublicId ( ) } ,
resultCredentialSourceIds : [ ] string { pCreds [ 0 ] . GetPublicId ( ) } ,
} ,
{
name : "Remove 1 duplicate set of 2 libraries" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "remove duplicate lib" ,
@ -3601,6 +3687,19 @@ func TestRemoveTargetCredentialSources(t *testing.T) {
} ,
resultCredentialSourceIds : [ ] string { updCreds [ 0 ] . GetPublicId ( ) } ,
} ,
{
name : "Remove 1 duplicate set of 2 static_p credentials" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "remove duplicate static_p" ,
target . WithStaticCredentials ( [ ] * target . StaticCredential {
target . TestNewStaticCredential ( "" , pCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
target . TestNewStaticCredential ( "" , pCreds [ 1 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
} ) ) ,
removeCredentialSources : [ ] string {
pCreds [ 1 ] . GetPublicId ( ) , pCreds [ 1 ] . GetPublicId ( ) ,
} ,
resultCredentialSourceIds : [ ] string { pCreds [ 0 ] . GetPublicId ( ) } ,
} ,
{
name : "Remove mixed sources from target" ,
tar : tcp . TestTarget ( ctx , t , conn , proj . GetPublicId ( ) , "remove mixed" ,
@ -3613,12 +3712,14 @@ func TestRemoveTargetCredentialSources(t *testing.T) {
target . TestNewStaticCredential ( "" , creds [ 1 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
target . TestNewStaticCredential ( "" , updCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
target . TestNewStaticCredential ( "" , updCreds [ 1 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
target . TestNewStaticCredential ( "" , pCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
target . TestNewStaticCredential ( "" , pCreds [ 1 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
} ) ) ,
removeCredentialSources : [ ] string {
cls [ 1 ] . GetPublicId ( ) , creds [ 0 ] . GetPublicId ( ) , updCreds [ 0 ] . GetPublicId ( ) ,
cls [ 1 ] . GetPublicId ( ) , creds [ 0 ] . GetPublicId ( ) , updCreds [ 0 ] . GetPublicId ( ) , pCreds [ 0 ] . GetPublicId ( ) ,
} ,
resultCredentialSourceIds : [ ] string {
cls [ 0 ] . GetPublicId ( ) , creds [ 1 ] . GetPublicId ( ) , updCreds [ 1 ] . GetPublicId ( ) ,
cls [ 0 ] . GetPublicId ( ) , creds [ 1 ] . GetPublicId ( ) , updCreds [ 1 ] . GetPublicId ( ) , pCreds [ 1 ] . GetPublicId ( ) ,
} ,
} ,
{
@ -3633,11 +3734,14 @@ func TestRemoveTargetCredentialSources(t *testing.T) {
target . TestNewStaticCredential ( "" , creds [ 1 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
target . TestNewStaticCredential ( "" , updCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
target . TestNewStaticCredential ( "" , updCreds [ 1 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
target . TestNewStaticCredential ( "" , pCreds [ 0 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
target . TestNewStaticCredential ( "" , pCreds [ 1 ] . GetPublicId ( ) , credential . BrokeredPurpose ) ,
} ) ) ,
removeCredentialSources : [ ] string {
cls [ 0 ] . GetPublicId ( ) , cls [ 1 ] . GetPublicId ( ) ,
creds [ 0 ] . GetPublicId ( ) , creds [ 1 ] . GetPublicId ( ) ,
updCreds [ 0 ] . GetPublicId ( ) , updCreds [ 1 ] . GetPublicId ( ) ,
pCreds [ 0 ] . GetPublicId ( ) , pCreds [ 1 ] . GetPublicId ( ) ,
} ,
resultCredentialSourceIds : [ ] string { } ,
} ,
@ -4283,6 +4387,20 @@ func TestAuthorizeSessionTypedCredentials(t *testing.T) {
require . NoError ( t , err )
require . NotNil ( t , updCredResp )
pCredResp , err := credService . CreateCredential ( ctx , & pbs . CreateCredentialRequest { Item : & credpb . Credential {
CredentialStoreId : staticStore . GetPublicId ( ) ,
Type : credential . PasswordSubtype . String ( ) ,
Name : wrapperspb . String ( "P Cred Name" ) ,
Description : wrapperspb . String ( "P Cred Description" ) ,
Attrs : & credpb . Credential_PasswordAttributes {
PasswordAttributes : & credpb . PasswordAttributes {
Password : wrapperspb . String ( "static-password" ) ,
} ,
} ,
} } )
require . NoError ( t , err )
require . NotNil ( t , pCredResp )
sshPkCredResp , err := credService . CreateCredential ( ctx , & pbs . CreateCredentialRequest { Item : & credpb . Credential {
CredentialStoreId : staticStore . GetPublicId ( ) ,
Type : credential . SshPrivateKeySubtype . String ( ) ,
@ -4588,6 +4706,32 @@ func TestAuthorizeSessionTypedCredentials(t *testing.T) {
} ,
wantedConnectionLimit : 1000 ,
} ,
{
name : "static-Password" ,
hostSourceId : shs . GetPublicId ( ) ,
credSourceId : pCredResp . GetItem ( ) . GetId ( ) ,
wantedHostId : h . GetPublicId ( ) ,
wantedEndpoint : h . GetAddress ( ) ,
wantedCred : & pb . SessionCredential {
CredentialSource : & pb . CredentialSource {
Id : pCredResp . GetItem ( ) . GetId ( ) ,
Name : pCredResp . GetItem ( ) . GetName ( ) . GetValue ( ) ,
Description : pCredResp . GetItem ( ) . GetDescription ( ) . GetValue ( ) ,
CredentialStoreId : staticStore . GetPublicId ( ) ,
Type : credstatic . Subtype . String ( ) ,
CredentialType : string ( globals . PasswordCredentialType ) ,
} ,
Credential : func ( ) * structpb . Struct {
data := map [ string ] any {
"password" : "static-password" ,
}
st , err := structpb . NewStruct ( data )
require . NoError ( t , err )
return st
} ( ) ,
} ,
wantedConnectionLimit : 1000 ,
} ,
{
name : "static-ssh-private-key" ,
hostSourceId : shs . GetPublicId ( ) ,