In this section, we will discuss how to protect a REST resource by implementing the security API using Kotlin. We created a resource to create and read an organization as an identity data in the previous chapter. In this chapter, we will add a security layer to this RESTful service by implementing custom HttpAuthenticationMechanism and IdentityStore mechanisms.
We will add the following security-related dependencies to the existing dependencies:
<dependency>
<groupId>org.glassfish.soteria</groupId>
<artifactId>javax.security.enterprise</artifactId>
<version>${org.glassfish.soteria}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId...