Application Platform 10.5 | Application Platform API | Adding Single Sign-On Authentication to Application Platform Projects | OSGi Service Layer Security | Declarative Security
 
Declarative Security
Application Platform enables you to add declarative security to POJOs that are published as OSGi services by using the @Service annotation. To add security to POJOs that are published as OSGi services, you can use the @Secure annotation, together with a set of common Java EE security annotations. Application Platform supports the following common Java EE security annotations, which you can use at the class or method level:
*@DenyAll
*@PermitAll
*@AclAllowed for Integration Server
The following sample code shows an OSGi service implementation of declarative security, where the @Secure annotation indicates that the AdderService service is secure and the invocation of the service methods is denied by default with the @DenyAll annotation. The example shows how users with Developer role in Integration Server, by using the @AclAllowed annotation, allow invocation of the add method:
@Service
@Secure
@DenyAll
public class AdderService {
 
     @AclAllowed({"Developer"})
     public float add(float x, float y) {
          return x + y;
     }
}