Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(FSADT1-817): adding internal pages #591

Merged
merged 23 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ Fixes # (issue)

## Further comments

<!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
<!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
16 changes: 8 additions & 8 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ jobs:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USERNAME }}
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }}
-p ORACLEDB_USER_W=${{ secrets.ORACLEDB_USERNAME_W }}
-p ORACLEDB_PASSWORD_W=${{ secrets.ORACLEDB_PASSWORD_W }}
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }}
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }}
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }}
Expand All @@ -180,7 +182,7 @@ jobs:
-p COGNITO_DOMAIN=${{ secrets.COGNITO_DOMAIN }}
-p COGNITO_ENVIRONMENT=TEST
-p COGNITO_REDIRECT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/dashboard
-p COGNITO_LOGOUT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/
-p COGNITO_LOGOUT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}

- name: Conventional Changelog Update
uses: TriPSs/conventional-changelog-action@v3
Expand Down Expand Up @@ -275,8 +277,7 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/frontend:${{ env.ZONE }}
-p VITE_KEYCLOAK_URL=https://test.loginproxy.gov.bc.ca/auth
-p VITE_KEYCLOAK_CLIENT_ID=${{ secrets.KEYCLOAK_CLIENT_ID }}
-p GREEN_DOMAIN=${{ secrets.GREEN_DOMAIN }}
-p VITE_NODE_ENV=openshift-${{ env.ZONE }}

- name: Deploy Processor
Expand Down Expand Up @@ -333,6 +334,8 @@ jobs:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USERNAME }}
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }}
-p ORACLEDB_USER_W=${{ secrets.ORACLEDB_USERNAME_W }}
-p ORACLEDB_PASSWORD_W=${{ secrets.ORACLEDB_PASSWORD_W }}
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }}
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }}
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }}
Expand All @@ -349,7 +352,7 @@ jobs:
-p COGNITO_DOMAIN=${{ secrets.COGNITO_DOMAIN }}
-p COGNITO_ENVIRONMENT=PROD
-p COGNITO_REDIRECT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/dashboard
-p COGNITO_LOGOUT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/
-p COGNITO_LOGOUT_URI=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}

prod-deploy:
name: PROD Deployment
Expand Down Expand Up @@ -422,8 +425,7 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/frontend:${{ env.PREV }}
-p VITE_KEYCLOAK_URL=https://loginproxy.gov.bc.ca/auth
-p VITE_KEYCLOAK_CLIENT_ID=${{ secrets.KEYCLOAK_CLIENT_ID }}
-p GREEN_DOMAIN=${{ secrets.GREEN_DOMAIN }}
-p VITE_NODE_ENV=openshift-${{ env.ZONE }}

- name: Deploy Processor
Expand All @@ -439,5 +441,3 @@ jobs:
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/processor:${{ env.PREV }}


4 changes: 3 additions & 1 deletion .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ jobs:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USERNAME }}
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }}
-p ORACLEDB_USER_W=${{ secrets.ORACLEDB_USERNAME_W }}
-p ORACLEDB_PASSWORD_W=${{ secrets.ORACLEDB_PASSWORD_W }}
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }}
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }}
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }}
Expand Down Expand Up @@ -184,7 +186,7 @@ jobs:
parameters:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/database:${{ github.event.number }}

- name: Deploy Backend
uses: bcgov-nr/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ objects:
- name: FRONTEND_URL
value: https://${NAME}-${ZONE}-frontend.${DOMAIN}
- name: LEGACY_URL
value: https://${NAME}-${ZONE}-legacy.${DOMAIN}
value: https://${NAME}-${ZONE}-legacy.${DOMAIN}/api
- name: CHES_CLIENT_ID
valueFrom:
secretKeyRef:
Expand Down
1 change: 0 additions & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
Expand Down
52 changes: 52 additions & 0 deletions backend/src/main/java/ca/bc/gov/app/ApplicationConstant.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,56 @@ public final class ApplicationConstant {
)
);

public static final String SUBMISSION_DETAILS_QUERY = """
SELECT
s.submission_id,
ssc.description as status,
stc.description as submission_type,
s.submission_date,
s.update_timestamp,
s.update_user,
btc.description as business_type,
sd.incorporation_number,
sd.client_number,
sd.organization_name,
ctc.description as client_type,
sd.good_standing_ind as good_standing
FROM nrfc.submission s
left join nrfc.submission_status_code ssc on ssc.submission_status_code = s.submission_status_code\s
left join nrfc.submission_type_code stc on stc.submission_type_code = s.submission_type_code
left join nrfc.submission_detail sd on sd.submission_id = s.submission_id\s
left join nrfc.business_type_code btc on btc.business_type_code = sd.business_type_code\s
left join nrfc.client_type_code ctc on ctc.client_type_code = sd.client_type_code\s
where s.submission_id = :submissionId""";
public static final String SUBMISSION_CONTACTS_QUERY = """
SELECT
ROW_NUMBER() OVER (order by sc.submission_contact_id ) AS index,
sc.contact_type_code,
ctc.description as contact_desc,
sc.first_name,
sc.last_name,
sc.business_phone_number,
sc.email_address,
(select STRING_AGG(sl.location_name,', ') as locations from nrfc.submission_location sl left join nrfc.submission_location_contact_xref slcx on slcx.submission_location_id = sl.submission_location_id left join nrfc.submission_contact sc on sc.submission_contact_id = slcx.submission_contact_id where sl.submission_id = :submissionId) as locations,
sc.idp_user_id
FROM nrfc.submission_contact sc
left join nrfc.contact_type_code ctc on ctc.contact_type_code = sc.contact_type_code
where sc.submission_id = :submissionId""";
public static final String SUBMISSION_LOCATION_QUERY = """
SELECT
ROW_NUMBER() OVER (order by sl.submission_location_id ) AS index,
sl.street_address,
sl.country_code,
cc.description as country_desc,
sl.province_code,
pc.description as province_desc,
sl.city_name,
sl.postal_code,
sl.location_name
FROM nrfc.submission_location sl
left join nrfc.country_code cc on cc.country_code = sl.country_code
left join nrfc.province_code pc on (pc.province_code = sl.province_code and pc.country_code = cc.country_code)
where sl.submission_id = :submissionId
order by sl.submission_location_id""";
}

7 changes: 0 additions & 7 deletions backend/src/main/java/ca/bc/gov/app/BootApplication.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
package ca.bc.gov.app;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@OpenAPIDefinition(info = @Info(
title = "${info.app.name}",
version = "${info.app.version}",
description = "${info.app.description}")
)
public class BootApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ public String getUrl() {
if (StringUtils.isNotBlank(this.url)) {
return this.url;
}
return "https://" + domain + ".auth." + region + ".amazoncognito.com";
return String.format("https://%s.auth.%s.amazoncognito.com",domain,region);
}

public String getRefreshUrl(){
return String.format("https://cognito-idp.%s.amazonaws.com/",domain);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
import ca.bc.gov.app.dto.client.ClientSubmissionDto;
import ca.bc.gov.app.dto.client.ClientValueTextDto;
import ca.bc.gov.app.dto.client.CodeNameDto;
import ca.bc.gov.app.dto.cognito.AuthResponse;
import ca.bc.gov.app.dto.cognito.AuthResponseDto;
import ca.bc.gov.app.dto.legacy.ForestClientDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aot.hint.annotation.RegisterReflectionForBinding;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -81,7 +82,7 @@
ChesMailRequest.class,
ChesMailResponse.class,
ChesMailErrorResponse.class,
AuthResponse.class,
AuthResponseDto.class,
BcRegistryDocumentRequestBodyDto.class,
BcRegistryDocumentAccessRequestDto.class,
BcRegistryDocumentAccessTypeDto.class,
Expand All @@ -94,7 +95,8 @@
BcRegistryAddressDto.class,
BcRegistryBusinessAdressesDto.class,
BcRegistryOfficerDto.class,
BcRegistryRoleDto.class
BcRegistryRoleDto.class,
ForestClientDto.class
})
public class GlobalServiceConfiguration {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
import ca.bc.gov.app.models.client.SubmissionStatusEnum;
import ca.bc.gov.app.service.client.ClientSubmissionService;
import ca.bc.gov.app.validator.client.ClientSubmitRequestValidator;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.headers.Header;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import java.util.Map;
import org.springframework.http.HttpStatus;
Expand All @@ -32,10 +25,6 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@Tag(
name = "FSA Clients",
description = "The FSA Client endpoint, responsible for handling client data"
)
@RestController
@RequestMapping(value = "/api/clients/submissions", produces = MediaType.APPLICATION_JSON_VALUE)
public class ClientSubmissionController extends
Expand All @@ -56,7 +45,7 @@ public Flux<ClientListSubmissionDto> listSubmissions(
int page,
@RequestParam(required = false, defaultValue = "10")
int size,
@RequestParam(required = false,defaultValue = "RNC,AAC")
@RequestParam(required = false, defaultValue = "RNC,AAC")
String[] requestType,
@RequestParam(required = false)
SubmissionStatusEnum[] requestStatus,
Expand All @@ -80,62 +69,6 @@ public Flux<ClientListSubmissionDto> listSubmissions(
}

@PostMapping
@Operation(
summary = "Submit client data",
responses = {
@ApiResponse(
responseCode = "201",
description = "New client submission posted",
content = @Content(
mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = String.class),
examples = {@ExampleObject(value = "Created")}
),
headers = {
@Header(
name = "Location",
schema = @Schema(
implementation = String.class,
example = "/api/clients/submissions/000123"
)
),
@Header(
name = "x-sub-id",
description = "ID of the submission that was created",
schema = @Schema(
implementation = String.class,
example = "000123"
)
),
@Header(
name = ApplicationConstant.USERID_HEADER,
description = "The ID of the submitter who is making the submission",
schema = @Schema(
implementation = String.class,
example = "1234"
)
),
@Header(
name = ApplicationConstant.USERMAIL_HEADER,
description = "The email address of the submitter who is making the submission",
schema = @Schema(
implementation = String.class,
example = "[email protected]"
)
),
@Header(
name = ApplicationConstant.USERNAME_HEADER,
description = "The name of the submitter who is making the submission",
schema = @Schema(
implementation = String.class,
example = "Joe Doe"
)
)
}
)
}
)

@ResponseStatus(HttpStatus.CREATED)
public Mono<Void> submit(
@RequestBody ClientSubmissionDto request,
Expand Down Expand Up @@ -165,5 +98,5 @@ public Mono<Void> submit(
)
.then();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public Mono<Void> logon(

String famUrl = String.format(
"%s/oauth2/authorize"
+ "?client_id=%s"
+ "&response_type=code"
+ "&identity_provider=%s-%s"
+ "&scope=openid"
+ "&state=%s"
+ "&code_challenge=%s"
+ "&code_challenge_method=S256"
+ "&redirect_uri=%s",
+ "?client_id=%s"
+ "&response_type=code"
+ "&identity_provider=%s-%s"
+ "&scope=openid"
+ "&state=%s"
+ "&code_challenge=%s"
+ "&code_challenge_method=S256"
+ "&redirect_uri=%s",
configuration.getCognito().getUrl(),
configuration.getCognito().getClientId(),
configuration.getCognito().getEnvironment(),
Expand Down Expand Up @@ -95,14 +95,14 @@ public Mono<Void> logout(

final String famUrl = String.format(
"%s/logout"
+ "?client_id=%s"
+ "&response_type=code"
+ "&scope=openid"
+ "&redirect_uri=%s"
+ "&logout_uri=%s",
+ "?client_id=%s"
+ "&response_type=code"
+ "&scope=openid"
+ "&redirect_uri=%s"
+ "&logout_uri=%s",
configuration.getCognito().getUrl(),
configuration.getCognito().getClientId(),
configuration.getCognito().getLogoutUri(),
configuration.getCognito().getRedirectUri(),
configuration.getCognito().getLogoutUri()
);

Expand All @@ -121,6 +121,14 @@ public Mono<Void> logout(
return Mono.empty();
}

@GetMapping("/refresh")
@ResponseStatus(HttpStatus.FOUND)
public Mono<Void> refresh(
@RequestParam(name = "code", required = false, defaultValue = "IDIR") String code
){
return service.refreshToken(code);
}

/**
* Execute the callback by exchanging the authorization code for tokens.
*
Expand Down
Loading
Loading