Get rid of old trust-auth config
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<7a9c0c1a8292affc2ed9584fca098c64>>
|
||||
* @generated SignedSource<<a65c1699d7cf70edf7084ad4f3eaf603>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -32,7 +32,6 @@ export type TrustCenterAccessGraphCreateMutation$data = {
|
||||
readonly email: string;
|
||||
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
||||
readonly id: string;
|
||||
readonly lastTokenExpiresAt: string | null | undefined;
|
||||
readonly name: string;
|
||||
readonly pendingRequestCount: number;
|
||||
};
|
||||
@@ -127,13 +126,6 @@ v3 = {
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "lastTokenExpiresAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -246,16 +238,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "b080e2a38e706bea45f06507675582a4",
|
||||
"cacheID": "6afb34eabf677345a8b94479a62b101d",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "TrustCenterAccessGraphCreateMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation TrustCenterAccessGraphCreateMutation(\n $input: CreateTrustCenterAccessInput!\n) {\n createTrustCenterAccess(input: $input) {\n trustCenterAccessEdge {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n }\n }\n }\n}\n"
|
||||
"text": "mutation TrustCenterAccessGraphCreateMutation(\n $input: CreateTrustCenterAccessInput!\n) {\n createTrustCenterAccess(input: $input) {\n trustCenterAccessEdge {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "c33af388ca0957f16ee36e06339d61d3";
|
||||
(node as any).hash = "71ca86286860103cdce4720d26a52f21";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<103e4c33c37a708bdc24fe74767725b9>>
|
||||
* @generated SignedSource<<0a06a583c9eafcd4b26a4ec7415ca88b>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -236,13 +236,6 @@ return {
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "lastTokenExpiresAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -326,16 +319,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "6b9515ca548d21d6ba53ac5d830010f5",
|
||||
"cacheID": "650290081ecafbf348f371c1becf15e3",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "TrustCenterAccessGraphPaginationQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query TrustCenterAccessGraphPaginationQuery(\n $count: Int\n $cursor: CursorKey\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TrustCenterAccessGraph_accesses\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n __typename\n }\n }\n }\n id\n}\n"
|
||||
"text": "query TrustCenterAccessGraphPaginationQuery(\n $count: Int\n $cursor: CursorKey\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TrustCenterAccessGraph_accesses\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n __typename\n }\n }\n }\n id\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "41517deef6af7eec916f3a4bbfc217b7";
|
||||
(node as any).hash = "7d69d885bc80ed04776bafa53157590e";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<4f1a16e8b28a887285c9bc578e201f75>>
|
||||
* @generated SignedSource<<4daa20d8f82a95b0d405c37e5bac0280>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -251,13 +251,6 @@ return {
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "lastTokenExpiresAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -341,12 +334,12 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "a8ee8e139d510095436df64e84d7a5ba",
|
||||
"cacheID": "605b209b5d31e97773f696a76b752bd5",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "TrustCenterAccessGraphQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query TrustCenterAccessGraphQuery(\n $trustCenterId: ID!\n $count: Int!\n $cursor: CursorKey\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n ...TrustCenterAccessGraph_accesses\n }\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n __typename\n }\n }\n }\n id\n}\n"
|
||||
"text": "query TrustCenterAccessGraphQuery(\n $trustCenterId: ID!\n $count: Int!\n $cursor: CursorKey\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n ...TrustCenterAccessGraph_accesses\n }\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n __typename\n }\n }\n }\n id\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<9f1d003a890186ec86cfd58e7eb3bf28>>
|
||||
* @generated SignedSource<<d0efc00be7fc303cb2c45ae11fe587c7>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -34,7 +34,6 @@ export type TrustCenterAccessGraphUpdateMutation$data = {
|
||||
readonly email: string;
|
||||
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
||||
readonly id: string;
|
||||
readonly lastTokenExpiresAt: string | null | undefined;
|
||||
readonly name: string;
|
||||
readonly pendingRequestCount: number;
|
||||
readonly updatedAt: string;
|
||||
@@ -126,13 +125,6 @@ v1 = [
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "lastTokenExpiresAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -172,16 +164,16 @@ return {
|
||||
"selections": (v1/*: any*/)
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "8b330240bc19bbebb3244a49dc0a6db0",
|
||||
"cacheID": "1367c160aa881878e5eed860509e7610",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "TrustCenterAccessGraphUpdateMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation TrustCenterAccessGraphUpdateMutation(\n $input: UpdateTrustCenterAccessInput!\n) {\n updateTrustCenterAccess(input: $input) {\n trustCenterAccess {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n updatedAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n }\n }\n}\n"
|
||||
"text": "mutation TrustCenterAccessGraphUpdateMutation(\n $input: UpdateTrustCenterAccessInput!\n) {\n updateTrustCenterAccess(input: $input) {\n trustCenterAccess {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n updatedAt\n pendingRequestCount\n activeCount\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "f78b4d25b0977a14269491db951a1d9d";
|
||||
(node as any).hash = "7e5d2ce261f3e877ef54e5acfbd00bde";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<6cbc57ab24be22cdb76257d73f3a47d5>>
|
||||
* @generated SignedSource<<17aba6dd50ebba280c11c963a4adede3>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -24,7 +24,6 @@ export type TrustCenterAccessGraph_accesses$data = {
|
||||
readonly email: string;
|
||||
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
||||
readonly id: string;
|
||||
readonly lastTokenExpiresAt: string | null | undefined;
|
||||
readonly name: string;
|
||||
readonly pendingRequestCount: number;
|
||||
};
|
||||
@@ -214,13 +213,6 @@ return {
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "lastTokenExpiresAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -296,6 +288,6 @@ return {
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "41517deef6af7eec916f3a4bbfc217b7";
|
||||
(node as any).hash = "7d69d885bc80ed04776bafa53157590e";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -30,7 +30,6 @@ export const trustCenterAccessesPaginationFragment = graphql`
|
||||
active
|
||||
hasAcceptedNonDisclosureAgreement
|
||||
createdAt
|
||||
lastTokenExpiresAt
|
||||
pendingRequestCount
|
||||
activeCount
|
||||
canUpdate: permission(action: "core:trust-center-access:update")
|
||||
@@ -71,7 +70,6 @@ export const createTrustCenterAccessMutation = graphql`
|
||||
active
|
||||
hasAcceptedNonDisclosureAgreement
|
||||
createdAt
|
||||
lastTokenExpiresAt
|
||||
pendingRequestCount
|
||||
activeCount
|
||||
canUpdate: permission(action: "core:trust-center-access:update")
|
||||
@@ -95,7 +93,6 @@ export const updateTrustCenterAccessMutation = graphql`
|
||||
hasAcceptedNonDisclosureAgreement
|
||||
createdAt
|
||||
updatedAt
|
||||
lastTokenExpiresAt
|
||||
pendingRequestCount
|
||||
activeCount
|
||||
}
|
||||
|
||||
@@ -48,10 +48,6 @@ export function TrustCenterAccessItem(props: TrustCenterAccessItemProps) {
|
||||
[deleteInvitation, connectionId],
|
||||
);
|
||||
|
||||
const isExpired = access.lastTokenExpiresAt
|
||||
? new Date(access.lastTokenExpiresAt) < new Date()
|
||||
: false;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tr
|
||||
@@ -62,11 +58,6 @@ export function TrustCenterAccessItem(props: TrustCenterAccessItemProps) {
|
||||
<Td className="font-medium">{access.name}</Td>
|
||||
<Td>{access.email}</Td>
|
||||
<Td>{formatDate(access.createdAt)}</Td>
|
||||
<Td className={isExpired ? "text-txt-danger" : ""}>
|
||||
{access.lastTokenExpiresAt
|
||||
? formatDate(access.lastTokenExpiresAt)
|
||||
: "-"}
|
||||
</Td>
|
||||
<Td>
|
||||
<div className="flex justify-center">
|
||||
{access.active ? (
|
||||
|
||||
@@ -169,7 +169,6 @@ export default function TrustCenterAccessTab() {
|
||||
<Th>{__("Name")}</Th>
|
||||
<Th>{__("Email")}</Th>
|
||||
<Th>{__("Date")}</Th>
|
||||
<Th>{__("Expires")}</Th>
|
||||
<Th className="text-center">{__("Active")}</Th>
|
||||
<Th className="text-center">{__("Access")}</Th>
|
||||
<Th className="text-center">{__("Requests")}</Th>
|
||||
@@ -208,9 +207,7 @@ export default function TrustCenterAccessTab() {
|
||||
<DialogContent padded className="space-y-6">
|
||||
<div>
|
||||
<p className="text-txt-secondary text-sm mb-4">
|
||||
{__(
|
||||
"Send a 30-day access token to an external person to view your trust center",
|
||||
)}
|
||||
{__("Give a person access to your trust center")}
|
||||
</p>
|
||||
|
||||
<Field
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
"embed"
|
||||
"fmt"
|
||||
htmltemplate "html/template"
|
||||
"math"
|
||||
texttemplate "text/template"
|
||||
"time"
|
||||
)
|
||||
@@ -156,21 +155,17 @@ func RenderFrameworkExport(baseURL, fullName, downloadUrl string) (subject strin
|
||||
return subjectFrameworkExport, textBody, htmlBody, err
|
||||
}
|
||||
|
||||
func RenderTrustCenterAccess(baseURL, fullName, organizationName, accessUrl string, tokenDuration time.Duration) (subject string, textBody string, htmlBody *string, err error) {
|
||||
durationInDays := int(math.Round(tokenDuration.Hours() / 24))
|
||||
|
||||
func RenderTrustCenterAccess(baseURL, fullName, organizationName, accessUrl string) (subject string, textBody string, htmlBody *string, err error) {
|
||||
data := struct {
|
||||
FullName string
|
||||
OrganizationName string
|
||||
AccessUrl string
|
||||
LogoURL string
|
||||
DurationInDays int
|
||||
}{
|
||||
FullName: fullName,
|
||||
OrganizationName: organizationName,
|
||||
AccessUrl: accessUrl,
|
||||
LogoURL: baseURL + logoURLPath,
|
||||
DurationInDays: durationInDays,
|
||||
}
|
||||
|
||||
textBody, htmlBody, err = renderEmail(trustCenterAccessTextTemplate, trustCenterAccessHTMLTemplate, data)
|
||||
|
||||
@@ -44,7 +44,6 @@ type (
|
||||
NDAFileID *gid.GID `db:"nda_file_id"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
LastTokenExpiresAt *time.Time `db:"last_token_expires_at"`
|
||||
}
|
||||
|
||||
TrustCenterAccesses []*TrustCenterAccess
|
||||
@@ -92,8 +91,7 @@ SELECT
|
||||
has_accepted_non_disclosure_agreement_metadata,
|
||||
nda_file_id,
|
||||
created_at,
|
||||
updated_at,
|
||||
last_token_expires_at
|
||||
updated_at
|
||||
FROM
|
||||
trust_center_accesses
|
||||
WHERE
|
||||
@@ -146,8 +144,7 @@ SELECT
|
||||
has_accepted_non_disclosure_agreement_metadata,
|
||||
nda_file_id,
|
||||
created_at,
|
||||
updated_at,
|
||||
last_token_expires_at
|
||||
updated_at
|
||||
FROM
|
||||
trust_center_accesses
|
||||
WHERE
|
||||
@@ -254,8 +251,7 @@ UPDATE trust_center_accesses SET
|
||||
updated_at = @updated_at,
|
||||
has_accepted_non_disclosure_agreement = @has_accepted_non_disclosure_agreement,
|
||||
has_accepted_non_disclosure_agreement_metadata = @has_accepted_non_disclosure_agreement_metadata,
|
||||
nda_file_id = @nda_file_id,
|
||||
last_token_expires_at = @last_token_expires_at
|
||||
nda_file_id = @nda_file_id
|
||||
WHERE
|
||||
%s
|
||||
AND id = @id
|
||||
@@ -270,8 +266,7 @@ WHERE
|
||||
"updated_at": tca.UpdatedAt,
|
||||
"has_accepted_non_disclosure_agreement": tca.HasAcceptedNonDisclosureAgreement,
|
||||
"has_accepted_non_disclosure_agreement_metadata": tca.HasAcceptedNonDisclosureAgreementMetadata,
|
||||
"nda_file_id": tca.NDAFileID,
|
||||
"last_token_expires_at": tca.LastTokenExpiresAt,
|
||||
"nda_file_id": tca.NDAFileID,
|
||||
}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
|
||||
@@ -330,8 +325,7 @@ SELECT
|
||||
has_accepted_non_disclosure_agreement_metadata,
|
||||
nda_file_id,
|
||||
created_at,
|
||||
updated_at,
|
||||
last_token_expires_at
|
||||
updated_at
|
||||
FROM
|
||||
trust_center_accesses
|
||||
WHERE
|
||||
|
||||
@@ -48,12 +48,6 @@ type ExportService interface {
|
||||
}
|
||||
|
||||
type (
|
||||
TrustConfig struct {
|
||||
TokenSecret string
|
||||
TokenDuration time.Duration
|
||||
TokenType string
|
||||
}
|
||||
|
||||
Service struct {
|
||||
pg *pg.Client
|
||||
s3 *s3.Client
|
||||
@@ -61,7 +55,6 @@ type (
|
||||
encryptionKey cipher.EncryptionKey
|
||||
baseURL string
|
||||
tokenSecret string
|
||||
trustConfig TrustConfig
|
||||
agentConfig agents.Config
|
||||
html2pdfConverter *html2pdf.Converter
|
||||
acmeService *certmanager.ACMEService
|
||||
@@ -78,7 +71,6 @@ type (
|
||||
scope coredata.Scoper
|
||||
baseURL string
|
||||
tokenSecret string
|
||||
trustConfig TrustConfig
|
||||
agent *agents.Agent
|
||||
fileManager *filemanager.Service
|
||||
Frameworks *FrameworkService
|
||||
@@ -129,7 +121,6 @@ func NewService(
|
||||
bucket string,
|
||||
baseURL string,
|
||||
tokenSecret string,
|
||||
trustConfig TrustConfig,
|
||||
agentConfig agents.Config,
|
||||
html2pdfConverter *html2pdf.Converter,
|
||||
acmeService *certmanager.ACMEService,
|
||||
@@ -151,7 +142,6 @@ func NewService(
|
||||
encryptionKey: encryptionKey,
|
||||
baseURL: baseURL,
|
||||
tokenSecret: tokenSecret,
|
||||
trustConfig: trustConfig,
|
||||
agentConfig: agentConfig,
|
||||
html2pdfConverter: html2pdfConverter,
|
||||
acmeService: acmeService,
|
||||
@@ -172,7 +162,6 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService {
|
||||
baseURL: s.baseURL,
|
||||
scope: coredata.NewScope(tenantID),
|
||||
tokenSecret: s.tokenSecret,
|
||||
trustConfig: s.trustConfig,
|
||||
agent: agents.NewAgent(nil, s.agentConfig),
|
||||
fileManager: s.fileManager,
|
||||
}
|
||||
|
||||
@@ -443,8 +443,6 @@ func (s TrustCenterAccessService) sendAccessEmail(ctx context.Context, tx pg.Con
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
expiresAt := now.Add(s.svc.trustConfig.TokenDuration)
|
||||
access.LastTokenExpiresAt = &expiresAt
|
||||
access.UpdatedAt = now
|
||||
|
||||
if err := access.Update(ctx, tx, s.svc.scope); err != nil {
|
||||
@@ -467,7 +465,6 @@ func (s TrustCenterAccessService) sendTrustCenterAccessEmail(
|
||||
name,
|
||||
companyName,
|
||||
accessURL,
|
||||
s.svc.trustConfig.TokenDuration,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot render trust center access email: %w", err)
|
||||
|
||||
@@ -73,7 +73,6 @@ type (
|
||||
Pg pgConfig `json:"pg"`
|
||||
Api apiConfig `json:"api"`
|
||||
Auth authConfig `json:"auth"`
|
||||
TrustAuth trustAuthConfig `json:"trust-auth"`
|
||||
TrustCenter trustCenterConfig `json:"trust-center"`
|
||||
AWS awsConfig `json:"aws"`
|
||||
Notifications notificationsConfig `json:"notifications"`
|
||||
@@ -133,16 +132,6 @@ func New() *Implm {
|
||||
DomainVerificationResolverAddr: "8.8.8.8:53",
|
||||
},
|
||||
},
|
||||
TrustAuth: trustAuthConfig{
|
||||
CookieName: "TCT",
|
||||
CookieDomain: "localhost",
|
||||
CookieDuration: 24,
|
||||
TokenDuration: 720,
|
||||
ReportURLDuration: 15,
|
||||
TokenSecret: "this-is-a-secure-secret-for-trust-token-signing-at-least-32-bytes",
|
||||
Scope: "trust_center_readonly",
|
||||
TokenType: "trust_center_access",
|
||||
},
|
||||
TrustCenter: trustCenterConfig{
|
||||
HTTPAddr: ":80",
|
||||
HTTPSAddr: ":443",
|
||||
@@ -220,12 +209,6 @@ func (impl *Implm) Run(
|
||||
return fmt.Errorf("cannot get cookie secret bytes: %w", err)
|
||||
}
|
||||
|
||||
_, err = impl.cfg.TrustAuth.GetTokenSecretBytes()
|
||||
if err != nil {
|
||||
rootSpan.RecordError(err)
|
||||
return fmt.Errorf("cannot get trust auth token secret bytes: %w", err)
|
||||
}
|
||||
|
||||
awsConfig := awsconfig.NewConfig(
|
||||
l,
|
||||
httpclient.DefaultPooledClient(
|
||||
@@ -274,12 +257,6 @@ func (impl *Implm) Run(
|
||||
ModelName: impl.cfg.OpenAI.ModelName,
|
||||
}
|
||||
|
||||
trustConfig := probo.TrustConfig{
|
||||
TokenSecret: impl.cfg.TrustAuth.TokenSecret,
|
||||
TokenDuration: time.Duration(impl.cfg.TrustAuth.TokenDuration) * time.Hour,
|
||||
TokenType: impl.cfg.TrustAuth.TokenType,
|
||||
}
|
||||
|
||||
agent := agents.NewAgent(l.Named("agent"), agentConfig)
|
||||
|
||||
fileManagerService := filemanager.NewService(s3Client)
|
||||
@@ -383,7 +360,6 @@ func (impl *Implm) Run(
|
||||
impl.cfg.AWS.Bucket,
|
||||
impl.cfg.BaseURL.String(),
|
||||
impl.cfg.Auth.Cookie.Secret,
|
||||
trustConfig,
|
||||
agentConfig,
|
||||
html2pdfConverter,
|
||||
acmeService,
|
||||
@@ -402,17 +378,11 @@ func (impl *Implm) Run(
|
||||
impl.cfg.AWS.Bucket,
|
||||
impl.cfg.BaseURL.String(),
|
||||
impl.cfg.EncryptionKey,
|
||||
impl.cfg.TrustAuth.TokenSecret,
|
||||
impl.cfg.GetSlackSigningSecret(),
|
||||
iamService,
|
||||
html2pdfConverter,
|
||||
fileManagerService,
|
||||
l,
|
||||
trust.TrustConfig{
|
||||
TokenSecret: impl.cfg.TrustAuth.TokenSecret,
|
||||
TokenDuration: time.Duration(impl.cfg.TrustAuth.TokenDuration) * time.Hour,
|
||||
TokenType: impl.cfg.TrustAuth.TokenType,
|
||||
},
|
||||
slackService,
|
||||
)
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ func NewTrustCenterAccess(tca *coredata.TrustCenterAccess) *TrustCenterAccess {
|
||||
HasAcceptedNonDisclosureAgreement: tca.HasAcceptedNonDisclosureAgreement,
|
||||
CreatedAt: tca.CreatedAt,
|
||||
UpdatedAt: tca.UpdatedAt,
|
||||
LastTokenExpiresAt: tca.LastTokenExpiresAt,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||
"go.gearno.de/kit/log"
|
||||
@@ -35,12 +34,6 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
TrustConfig struct {
|
||||
TokenSecret string
|
||||
TokenDuration time.Duration
|
||||
TokenType string
|
||||
}
|
||||
|
||||
Service struct {
|
||||
pg *pg.Client
|
||||
s3 *s3.Client
|
||||
@@ -54,7 +47,6 @@ type (
|
||||
html2pdfConverter *html2pdf.Converter
|
||||
fileManager *filemanager.Service
|
||||
logger *log.Logger
|
||||
trustConfig TrustConfig
|
||||
slack *slack.Service
|
||||
}
|
||||
|
||||
@@ -65,13 +57,11 @@ type (
|
||||
scope coredata.Scoper
|
||||
proboSvc *probo.Service
|
||||
encryptionKey cipher.EncryptionKey
|
||||
tokenSecret string
|
||||
baseURL string
|
||||
iam *iam.Service
|
||||
html2pdfConverter *html2pdf.Converter
|
||||
fileManager *filemanager.Service
|
||||
logger *log.Logger
|
||||
trustConfig TrustConfig
|
||||
TrustCenters *TrustCenterService
|
||||
Documents *DocumentService
|
||||
Audits *AuditService
|
||||
@@ -92,13 +82,11 @@ func NewService(
|
||||
bucket string,
|
||||
baseURL string,
|
||||
encryptionKey cipher.EncryptionKey,
|
||||
tokenSecret string,
|
||||
slackSigningSecret string,
|
||||
iam *iam.Service,
|
||||
html2pdfConverter *html2pdf.Converter,
|
||||
fileManagerService *filemanager.Service,
|
||||
logger *log.Logger,
|
||||
trustConfig TrustConfig,
|
||||
slack *slack.Service,
|
||||
) *Service {
|
||||
return &Service{
|
||||
@@ -106,14 +94,12 @@ func NewService(
|
||||
s3: s3Client,
|
||||
bucket: bucket,
|
||||
encryptionKey: encryptionKey,
|
||||
tokenSecret: tokenSecret,
|
||||
slackSigningSecret: slackSigningSecret,
|
||||
baseURL: baseURL,
|
||||
iam: iam,
|
||||
html2pdfConverter: html2pdfConverter,
|
||||
fileManager: fileManagerService,
|
||||
logger: logger,
|
||||
trustConfig: trustConfig,
|
||||
slack: slack,
|
||||
}
|
||||
}
|
||||
@@ -126,13 +112,11 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService {
|
||||
scope: coredata.NewScope(tenantID),
|
||||
proboSvc: s.proboSvc,
|
||||
encryptionKey: s.encryptionKey,
|
||||
tokenSecret: s.tokenSecret,
|
||||
baseURL: s.baseURL,
|
||||
iam: s.iam,
|
||||
html2pdfConverter: s.html2pdfConverter,
|
||||
fileManager: s.fileManager,
|
||||
logger: s.logger,
|
||||
trustConfig: s.trustConfig,
|
||||
}
|
||||
|
||||
tenantService.TrustCenters = &TrustCenterService{svc: tenantService}
|
||||
|
||||
@@ -485,8 +485,6 @@ func (s *TrustCenterAccessService) sendAccessEmail(ctx context.Context, tx pg.Co
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
expiresAt := now.Add(s.svc.trustConfig.TokenDuration)
|
||||
access.LastTokenExpiresAt = &expiresAt
|
||||
access.UpdatedAt = now
|
||||
|
||||
if err := access.Update(ctx, tx, s.svc.scope); err != nil {
|
||||
@@ -509,7 +507,6 @@ func (s *TrustCenterAccessService) sendTrustCenterAccessEmail(
|
||||
name,
|
||||
companyName,
|
||||
accessURL,
|
||||
s.svc.trustConfig.TokenDuration,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot render trust center access email: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user