Shared Opal components for authentication, authorisation, and other cross-cutting concerns. This module builds a reusable Java library—there is no runnable Spring Boot application here.
Use the bundled Gradle wrapper:
./gradlew clean buildThe task runs the JUnit 5 test suite and produces build/libs/opal-common-lib-<version>.jar.
During day-to-day work the library is usually brought into opal-fines-service via Gradle composite build (includeBuild('../opal-common-lib') in settings.gradle), which gives instant feedback in IntelliJ.
- Library source lives under
src/main/java/uk/gov/hmcts/opal/common/...; unit tests live insrc/test/java/uk/gov/hmcts/opal/common/.... - Additional source sets (
functionalTest,integrationTest,smokeTest) are configured and available if extra coverage is helpful. - Dependency versions are managed through the Spring Boot and Spring Cloud BOMs declared in
build.gradle. - If you prefer testing the published coordinates instead of
includeBuild, install the jar to your local Maven cache:Then depend on./gradlew publishToMavenLocal
uk.gov.hmcts:opal-common-lib:<version>from the consuming project.
The shared authentication models expose permissions via the PermissionDescriptor
contract. Each consuming service supplies its own implementation (an enum is the
recommended approach) that returns the numeric id issued by the user service. For example:
@Getter
@RequiredArgsConstructor
public enum FinesPermission implements PermissionDescriptor {
ACCOUNT_ENQUIRY(3L, "Account Enquiry");
private final long id;
private final String description;
}Those enums can then be passed straight into UserState and BusinessUnitUser
helpers (hasPermission, anyBusinessUnitUserHasPermission, etc.).
Azure Artifacts publishing is handled by the CI pipeline once pull requests merge; no local publish step is required when developing.
This project is licensed under the MIT License – see LICENSE for details.