This project provides integration with the DEEP orchestrator and OpenID connect log-in support through Spring Social to Spring projects.
Maven is needed to build the source code. To build a binary just execute mvn clean install
and the jar should be in the target
folder.
- Add the generated jar to the Spring project classpath either by a dependency management tool like Maven or Gradle or copying the jar directly to the project's classpath. For maven the dependency is:
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-oidc-deep</artifactId>
<version>1.4</version>
- Follow the steps described in Spring social documentation to enable Spring Social in your project and create a SocialConfigurer and adding a
SocialConfigurer
class and add a connection factory like in this snippet:
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer connectionFactoryConfigurer, Environment environment) {
connectionFactoryConfigurer.addConnectionFactory(
new OidcConnectionFactory(certKeystore, issuer, clientId, clientSecret));
}
Where:
certKeystore
is the location of a JKS keystore containing orchestrators certificates in case it's self-signed or invalid. If the orchestrator has a valid certificate then this parameter can be null.issuer
is the root URL of the IAM issuer instanceclient-id
andclient-sectet
are the application client identifier and secret to use to authenticate through the code workflow.
In Spring beans and components whose scope is bound to the request, the DEEP orchestrator can be directly injected using the @Inject
or @Autowired
annotations:
@Autowired
private DeepOrchestrator orchestratorClient;
In Spring beans whose scope is not bound to the actual request, the DEEP orchestrator can be obtained by the following snippet:
@Autowired
private ConnectionRepository repository;
private DeepOrchestrator getClient() {
Connection<DeepOrchestrator> connection = repository.findPrimaryConnection(DeepOrchestrator.class);
DeepOrchestrator deepOrchestrator = connection != null ? connection.getApi() : null;
return deepOrchestrator;
}
It's not recommended to access the IAM token directly and instead it's strongly preferred to implement further operations and services in this plug in and then access them as client with the method defined above, however, if necessary, once configured, you can get the current access and refresh tokens from the current user by:
- Add a reference to the
ConnectionRepository
object in your class:
@Inject
private ConnectionRepository connRepository;
- Access the tokens with the following snippet:
connRepository.getPrimaryConnection(DeepOrchestrator.class).createData()