Implementing security API using Kotlin

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> <version>${javax.servlet-api}</version> ...

Get Kotlin for Enterprise Applications using Java EE now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.