To use the stateless isis token in a microservice you need to follow these steps
- Add anubis to your class path. And anubis-test to your tests class path.
- Annotate your configuration with @EnableAnubis. For example
@Configuration @EnableAutoConfiguration @EnableTenantContext > @EnableAnubis @ComponentScan({"io.mifos.anubis.example.simple"}) public class ExampleConfiguration {}
- Add @Permittable to those endpoints which you wish to provide tenant token protected access to. For example:
@RequestMapping(value = "/dummy", method = RequestMethod.GET) > @Permittable(value = AcceptedTokenType.TENANT, groupId = PermittableGroupIds.DUMMY_MANAGEMENT) public @ResponseBody ResponseEntity<Void> readPermittableResource() { return ResponseEntity.accepted().build(); }
- Use the SecurityMock in your tests to mock a system token for initialize: (Be sure to also EnableApiFactory and use the api factory to get a feign client for your service so that the api factory interceptors can do their magic.) See the template project for an up-to-date example of how to do this.
- Use the SecurityMock in your tests to mock a user token for calls into tenant-specific service functionality. See the template project for an up-to-date example of how to do this.