Realm Identity Stores
Since Payara Server 5.194
The Payara API provides a way to authenticate with the existing realms using the @RealmIdentityStoreDefinition
annotation.
Usage
The realm identity store is defined through the @RealmIdentityStoreDefinition
annotation.
Specifying this in a valid place as defined by the Jakarta EE Security API will create the identity store.
Often this may mean that any class is a valid position.
Example
The following code sample illustrates how to configure realm identity store:
@ApplicationScoped
@ApplicationPath("/rest")
@DeclareRoles({ "a", "b"})
@BasicAuthenticationMechanismDefinition(realmName = "file")
@RealmIdentityStoreDefinition("file")
public class MyRestApp extends Application {
}
The RealmIdentityStoreDefinition
is a repeatable annotation hence multiple realms can also be defined:
@ApplicationScoped
@ApplicationPath("/rest")
@DeclareRoles({ "a", "b"})
@BasicAuthenticationMechanismDefinition
@RealmIdentityStoreDefinition("realm1")
@RealmIdentityStoreDefinition("realm2")
public class MyRestApp extends Application {
}