This is a client library for interacting with the idam application.
Add the library as a dependency of your project and configure the spring application to scan for Feign clients in the uk.gov.hmcts.reform.idam
package:
@EnableFeignClients(basePackages = {"uk.gov.hmcts.reform.idam"})
public class YourSpringApplication { }
You will also need to set the spring configuration property of idam.api.url
Optionally if you are authenticating a user you can use provide client configuration:
idam:
api:
url: http://localhost:8080
client:
id: client_id
secret: 123456
redirect_uri: https://localhost:3000/receiver
A client (IdamClient) is provided for interacting with the IdamApi feign client to simplify the log in flow:
@Service
class UserService {
private final IdamClient idamClient;
UserService(IdamClient idamClient) {
this.idamClient = idamClient;
}
public UserDetails authenticateUser(String username, String password) {
return idamClient.authenticateUser(username, password);
}
}
Components provided by this library will get automatically configured in a Spring context if idam.api.url
configuration property is defined and does not equal false
.
The project uses Gradle as a build tool but you don't have install it locally since there is a
./gradlew
wrapper script.
To build project please execute the following command:
./gradlew build
To run all checks (including unit tests) please execute the following command:
./gradlew check
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MIT License - see the LICENSE.md file for details.