-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix conflict post refactoring (#760)
* Handle multiple registered directories in BFF * Version bump to v1.5.0 * Certman refactor and automated reissuance (#753) Co-authored-by: kbelita <[email protected]> Co-authored-by: Daniel Sollis <[email protected]> * sc-8837 Extend Background Color to bottom of Overview page (#754) * sc-8408 Add min/max to date of incorporation field (#743) * Handle multiple registered directories in BFF * sc-8408 Add min/max to date of incorporation field Co-authored-by: Benjamin Bengfort <[email protected]> * sc-8837 Extend Background Color to bottom of Overview page Co-authored-by: Benjamin Bengfort <[email protected]> Co-authored-by: Cletus Razakou <[email protected]> * adds slack notifications to Github Actions container build yaml (#755) Co-authored-by: Cletus Razakou <[email protected]> * Allow multiple DNS names in certificate issuance (#701) Co-authored-by: Benjamin Bengfort <[email protected]> * Add baggage to CORS allowed headers * BFF test cleanup (#706) * BFF string constants (#708) * Add VASP timestamps to overview response (#740) * version bump v1.5.0-rc.22 * add VASP timestamps to overview response * Emit unpopulated registration form fields (#741) * sc-8837 Extend Background Color to bottom of Overview page (#754) * sc-8408 Add min/max to date of incorporation field (#743) * Handle multiple registered directories in BFF * sc-8408 Add min/max to date of incorporation field Co-authored-by: Benjamin Bengfort <[email protected]> * sc-8837 Extend Background Color to bottom of Overview page Co-authored-by: Benjamin Bengfort <[email protected]> Co-authored-by: Cletus Razakou <[email protected]> * fix models merge conflicts Co-authored-by: Benjamin Bengfort <[email protected]> Co-authored-by: Patrick Deziel <[email protected]> Co-authored-by: kbelita <[email protected]> Co-authored-by: Daniel Sollis <[email protected]> Co-authored-by: elysee15 <[email protected]> Co-authored-by: Rebecca Bilbro <[email protected]>
- Loading branch information
1 parent
b457fa8
commit 271d164
Showing
26 changed files
with
312 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import ( | |
|
||
"github.com/trisacrypto/directory/pkg/bff/api/v1" | ||
"github.com/trisacrypto/directory/pkg/bff/auth" | ||
"github.com/trisacrypto/directory/pkg/bff/config" | ||
records "github.com/trisacrypto/directory/pkg/bff/db/models/v1" | ||
"github.com/trisacrypto/directory/pkg/gds/admin/v2" | ||
"github.com/trisacrypto/directory/pkg/gds/models/v1" | ||
|
@@ -27,9 +28,9 @@ func (s *Server) GetCertificates(ctx context.Context, testnetID, mainnetID strin | |
rpc := func(ctx context.Context, client admin.DirectoryAdministrationClient, network string) (rep interface{}, err error) { | ||
var vaspID string | ||
switch network { | ||
case testnet: | ||
case config.TestNet: | ||
vaspID = testnetID | ||
case mainnet: | ||
case config.MainNet: | ||
vaspID = mainnetID | ||
default: | ||
return nil, fmt.Errorf("unknown network: %s", network) | ||
|
@@ -134,11 +135,13 @@ func (s *Server) Certificates(c *gin.Context) { | |
} | ||
|
||
const ( | ||
testnetName = "TestNet" | ||
mainnetName = "MainNet" | ||
supportEmail = "[email protected]" | ||
StartRegistration = "Start the registration and verification process for your organization to receive an X.509 Identity Certificate and become a trusted member of the TRISA network." | ||
CompleteRegistration = "Complete the registration process and verification process for your organization to receive an X.509 Identity Certificate and become a trusted member of the TRISA network." | ||
SubmitTestnet = "Review and submit your TestNet registration." | ||
SubmitMainnet = "Review and submit your MainNet registration." | ||
SubmitTestnet = "Review and submit your " + testnetName + " registration." | ||
SubmitMainnet = "Review and submit your " + mainnetName + " registration." | ||
VerifyEmails = "Your organization's %s registration has been submitted and verification emails have been sent to the contacts specified in the form. Contacts and email addresses must be verified as the first step in the approval process. Please request that contacts verify their email addresses promptly so that the TRISA Validation Team can proceed with the validation process. Please contact TRISA support at " + supportEmail + " if contacts have not received the verification email and link." | ||
RegistrationPending = "Your organization's %s registration has been received and is pending approval. The TRISA Validation Team will notify you about the outcome." | ||
RegistrationRejected = "Your organization's %s registration has been rejected by the TRISA Validation Team. This means your organization is not a verified member of the TRISA network and cannot communicate with other members. Please contact TRISA support at " + supportEmail + " for additional details and next steps." | ||
|
@@ -156,9 +159,9 @@ func (s *Server) GetVASPs(ctx context.Context, testnetID, mainnetID string) (tes | |
rpc := func(ctx context.Context, client admin.DirectoryAdministrationClient, network string) (rep interface{}, err error) { | ||
var vaspID string | ||
switch network { | ||
case testnet: | ||
case config.TestNet: | ||
vaspID = testnetID | ||
case mainnet: | ||
case config.MainNet: | ||
vaspID = mainnetID | ||
default: | ||
return nil, fmt.Errorf("unknown network: %s", network) | ||
|
@@ -351,7 +354,7 @@ func (s *Server) Attention(c *gin.Context) { | |
|
||
// Get attention messages relating to certificates | ||
var testnetMsg *api.AttentionMessage | ||
if testnetMsg, err = registrationMessage(testnetVASP, "TestNet"); err != nil { | ||
if testnetMsg, err = registrationMessage(testnetVASP, testnetName); err != nil { | ||
log.Error().Err(err).Msg("could not get testnet certificate attention message") | ||
c.JSON(http.StatusInternalServerError, api.ErrorResponse(err)) | ||
return | ||
|
@@ -361,7 +364,7 @@ func (s *Server) Attention(c *gin.Context) { | |
} | ||
|
||
var mainnetMsg *api.AttentionMessage | ||
if mainnetMsg, err = registrationMessage(mainnetVASP, "MainNet"); err != nil { | ||
if mainnetMsg, err = registrationMessage(mainnetVASP, mainnetName); err != nil { | ||
log.Error().Err(err).Msg("could not get mainnet certificate attention message") | ||
c.JSON(http.StatusInternalServerError, api.ErrorResponse(err)) | ||
return | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package models_test | ||
|
||
import ( | ||
"encoding/json" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"github.com/trisacrypto/directory/pkg/bff/db/models/v1" | ||
"google.golang.org/protobuf/proto" | ||
) | ||
|
||
// Test that the registration form marshals and unmarshals correctly to and from JSON | ||
func TestMarshalRegistrationForm(t *testing.T) { | ||
// Empty form should be marshaled correctly and contain default values | ||
form := &models.RegistrationForm{} | ||
data, err := json.Marshal(form) | ||
require.NoError(t, err, "error marshaling empty registration form to JSON") | ||
require.Greater(t, len(string(data)), 2, "missing fields should be populated in marshaled JSON") | ||
|
||
// Empty form should be unmarshaled correctly | ||
require.NoError(t, json.Unmarshal(data, form), "error unmarshaling empty registration form from JSON") | ||
require.True(t, proto.Equal(&models.RegistrationForm{}, form), "empty registration form should be unmarshaled correctly") | ||
|
||
// Form with data should be marshaled correctly | ||
form = &models.RegistrationForm{ | ||
Website: "https://alice.example.com", | ||
} | ||
data, err = json.Marshal(form) | ||
require.NoError(t, err, "error marshaling registration form to JSON") | ||
|
||
// Form with data should be unmarshaled correctly | ||
result := &models.RegistrationForm{} | ||
require.NoError(t, json.Unmarshal(data, result), "error unmarshaling registration form from JSON") | ||
require.True(t, proto.Equal(form, result), "registration form should be unmarshaled correctly") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.