generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
603aa74
commit a6e696c
Showing
14 changed files
with
189 additions
and
54 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
6 changes: 6 additions & 0 deletions
6
projects/cas3-and-delius/src/dev/resources/local-public-key.pub
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,6 @@ | ||
-----BEGIN PUBLIC KEY----- | ||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCc2Dlk/NOvXrjSs83W+Nj4bMfz | ||
6svg2ulfcqTcEoA/Vy6FWK3pOX50VZph3V0Sbh8OTRyHgTw3BRQKrxE/TdsUWw8A | ||
QxgbjBWypmm6I/gUGeiSgYwATZpdVbqmuNI0BRg5l/vgJki6K5cg+4fRazZXaHvN | ||
ldzA6bUDdyt73u7qSwIDAQAB | ||
-----END PUBLIC KEY----- |
24 changes: 15 additions & 9 deletions
24
projects/cas3-and-delius/src/dev/resources/messages/referral-submitted.json
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 |
---|---|---|
@@ -1,12 +1,18 @@ | ||
{ | ||
"MessageId": "ae06c49e-1f41-4b9f-b2f2-dcca610d02cd", | ||
"Type": "Notification", | ||
"Timestamp": "2019-10-21T14:01:18.500Z", | ||
"Message": "{\n \"eventType\": \"accommodation.cas3.referral.submitted\",\n \"version\": 1,\n \"description\": \"CAS3 Referral has been submitted\",\n \"detailUrl\": \"\",\n \"occurredAt\": \"2022-12-04T10:42:43+00:00\",\n \"additionalInformation\": {\n \"applicationId\": \"68df9f6c-3fcb-4ec6-8fcf-96551cd9b080\"\n },\n \"personReference\": {\n \"identifiers\": [\n {\n \"type\": \"CRN\",\n \"value\": \"A000001\"\n }\n ]\n }\n}", | ||
"MessageAttributes": { | ||
"eventType": { | ||
"Type": "String", | ||
"Value": "accommodation.cas3.referral.submitted" | ||
} | ||
"eventType": "accommodation.cas3.referral.submitted", | ||
"version": 1, | ||
"description": "A cas3 referral has been submitted", | ||
"detailUrl": "http://localhost:{wiremock.port}/cas3-api/events/referral-submitted/1234", | ||
"occurredAt": "2022-12-04T10:42:43+00:00", | ||
"additionalInformation": { | ||
"applicationId": "68df9f6c-3fcb-4ec6-8fcf-96551cd9b080" | ||
}, | ||
"personReference": { | ||
"identifiers": [ | ||
{ | ||
"type": "CRN", | ||
"value": "A000001" | ||
} | ||
] | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
projects/cas3-and-delius/src/dev/resources/simulations/__files/cas3-referral-submitted.json
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,13 @@ | ||
{ | ||
"id": "364145f9-0af8-488e-9901-b4c46cd9ba37", | ||
"timestamp": "2022-11-30T14:53:44", | ||
"eventType": "accommodation.cas3.referral.submitted", | ||
"eventDetails": { | ||
"applicationId": "68df9f6c-3fcb-4ec6-8fcf-96551cd9b080", | ||
"applicationUrl": "https://approved-premises-dev.hmpps.service.justice.gov.uk/application/68df9f6c-3fcb-4ec6-8fcf-96551cd9b080", | ||
"personReference": { | ||
"crn": "A000001", | ||
"noms": "A0001AA" | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
projects/cas3-and-delius/src/dev/resources/simulations/__files/hmpps-auth-token-body.json
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,10 @@ | ||
{ | ||
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJwcm9iYXRpb24taW50ZWdyYXRpb24tZGV2IiwiZ3JhbnRfdHlwZSI6ImNsaWVudF9jcmVkZW50aWFscyIsInVzZXJfbmFtZSI6InByb2JhdGlvbi1pbnRlZ3JhdGlvbi1kZXYiLCJzY29wZSI6WyJyZWFkIiwid3JpdGUiXSwiYXV0aF9zb3VyY2UiOiJub25lIiwiaXNzIjoiaHR0cHM6Ly9zaWduLWluLWRldi5obXBwcy5zZXJ2aWNlLmp1c3RpY2UuZ292LnVrL2F1dGgvaXNzdWVyIiwiZXhwIjo5OTk5OTk5OTk5LCJhdXRob3JpdGllcyI6WyJST0xFX0FQUFJPVkVEX1BSRU1JU0VTX1NUQUZGIl0sImp0aSI6IjI1RHVSbjEtaHlIWmV3TGNkSkp4d1ZMMDNLVSIsImNsaWVudF9pZCI6InByb2JhdGlvbi1pbnRlZ3JhdGlvbi1kZXYiLCJpYXQiOjE2NjM3NTczMTF9.HmAw0LBKPSHHyDh1egCb1i2ubjzDQ9x43XKDt-Qg09GsS7RuroBUm2BmRoCXPIapSve-BaUBWGa_pPopsaX6VBlzHBOWZPu68HaCkzBa82fwvyVPI3s88eJBUemEOZWQ0RmCx8KiPjK53-rZEhx_aEMJSQoHJIrFK86TjLwphk4", | ||
"token_type": "bearer", | ||
"expires_in": 9999999999, | ||
"scope": "read write", | ||
"sub": "probation-integration-dev", | ||
"auth_source": "none", | ||
"jti": "fN29JHJy1N7gcYvqe-8B_k5T0mA", | ||
"iss": "https://sign-in-dev.hmpps.service.justice.gov.uk/auth/issuer" | ||
} |
17 changes: 17 additions & 0 deletions
17
projects/cas3-and-delius/src/dev/resources/simulations/mappings/cas3-api.json
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,17 @@ | ||
{ | ||
"mappings": [ | ||
{ | ||
"request": { | ||
"method": "GET", | ||
"urlPath": "/cas3-api/events/referral-submitted/1234" | ||
}, | ||
"response": { | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"status": 200, | ||
"bodyFileName": "cas3-referral-submitted.json" | ||
} | ||
} | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
projects/cas3-and-delius/src/dev/resources/simulations/mappings/hmpps-auth.json
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,13 @@ | ||
{ | ||
"request": { | ||
"method": "POST", | ||
"urlPath": "/auth/oauth/token" | ||
}, | ||
"response": { | ||
"headers": { | ||
"Content-Type": "application/json" | ||
}, | ||
"status": 200, | ||
"bodyFileName": "hmpps-auth-token-body.json" | ||
} | ||
} |
45 changes: 24 additions & 21 deletions
45
...-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/CASIntegrationTest.kt
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
15 changes: 15 additions & 0 deletions
15
.../cas3-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/config/FeignOAuth2Config.kt
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,15 @@ | ||
package uk.gov.justice.digital.hmpps.config | ||
|
||
import org.springframework.cloud.openfeign.EnableFeignClients | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager | ||
import uk.gov.justice.digital.hmpps.config.feign.FeignConfig | ||
import uk.gov.justice.digital.hmpps.integrations.approvedpremesis.ApprovedPremisesApiClient | ||
|
||
@Configuration | ||
@EnableFeignClients(clients = [ApprovedPremisesApiClient::class]) | ||
class FeignOAuth2Config( | ||
authorizedClientManager: OAuth2AuthorizedClientManager | ||
) : FeignConfig(authorizedClientManager) { | ||
override fun registrationId() = "cas3-and-delius" | ||
} |
15 changes: 15 additions & 0 deletions
15
...n/uk/gov/justice/digital/hmpps/integrations/approvedpremesis/ApprovedPremisesApiClient.kt
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,15 @@ | ||
package uk.gov.justice.digital.hmpps.integrations.approvedpremesis | ||
|
||
import org.springframework.cloud.openfeign.FeignClient | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import uk.gov.justice.digital.hmpps.config.FeignOAuth2Config | ||
import java.net.URI | ||
|
||
@FeignClient( | ||
name = "approved-premises-api", | ||
url = "https://dummy-url/to/be/overridden", | ||
configuration = [FeignOAuth2Config::class] | ||
) | ||
interface ApprovedPremisesApiClient { | ||
@GetMapping fun getApplicationSubmittedDetails(uri: URI): EventDetails<ApplicationSubmitted> | ||
} |
14 changes: 14 additions & 0 deletions
14
...rc/main/kotlin/uk/gov/justice/digital/hmpps/integrations/approvedpremesis/EventDetails.kt
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,14 @@ | ||
package uk.gov.justice.digital.hmpps.integrations.approvedpremesis | ||
|
||
import java.time.ZonedDateTime | ||
|
||
data class EventDetails<T>( | ||
val id: String, | ||
val timestamp: ZonedDateTime, | ||
val eventType: String, | ||
val eventDetails: T | ||
) | ||
|
||
data class ApplicationSubmitted( | ||
val applicationId: String | ||
) |
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