A Closer Look at the Java Identity API
Join the DZone community and get the full member experience.Join For Free
before i jump into the nitty-gritty, let’s take a look at some of the quick facts about java identity api jsr 351 . this is a still a work in progress . . .
- when was the jsr initiated?
this jsr passed the approval ballot in october 2011 which was followed by expert group formation in november 2011.
- who is leading this specification?
the java identity api is being lead by ron monzillo
- expert group?
the eg consists of representatives from oracle, ibm, redhat, sap and goldmansachs as well as individuals
- specification document?
this is still in a draft phase and is available at https://jcp.org/aboutjava/communityprocess/edr/jsr351/index.html
- reference implementation
nobis is the ri for the java identity api and can be accessed at https://java.net/projects/nobis/pages/home
if i had to explain the motive behind the java identity api in a single line, it would be defined as, a java standard for identity management
on a high level, the primary goals of this standard are,
- define a representation for an identity in java
- facilitate secure usage (creation, exchange, governance) of these ‘identities’ by defining a standard api and interaction models between identity consumers and providers
- provide a uniform, high level programming model for application to interact with identity/attribute repositories with heterogeneous domain models
currently, the java platform does not provide standard interfaces for managing identities. with the increasing use of internet services in day to day applications, adoption of sso and federation, there is a need to protect network identity. existing java objects, such as the x509certificate and kerberosticket provide semblance for encapsulating identity attributes, but only to a limited extent. instead of having disparate and non standard model, there is a requirement for a set of standards to evolve, which can be leveraged by application or identity framework developers to provide rock solid support for propagation and consumption of network identity.
a simple analogy
i like to think of it as an api similar to jdbc or jndi (if not the same). both these apis, help developers communicate with underlying data sources or naming services in a loosely coupled fashion through standard interfaces. it allows us to adopt a pluggable architecture wherein different vendor implementations can be leveraged to connect disparate databases (be it oracle, mysql, sybase db2 . . we really do not care apart from having the vendor jars in our class path), ldap servers (ad, oid, sun java, apache etc)
how can the java identity api help?
this api will
- allow applications to interact with heterogeneous underlying identity repositories in a portable and standard fashion.
- allow vendors to develop implementations using the attribute service framework to seamlessly interact with attributes in one or more repositories e.g. facebook , twitter , linked in via supported protocols/apis such as oauth , open id , facebook connect etc.
- enable applications to also act as providers of attributes – this is also a part of the attribute service framework
- allow the end developers to build applications on top of these implementations.
- prevent dependency upon non standard, proprietary implementations to implement identity services within applications
some of the key features/highlights of this api have been listed below
- compatibility with java se 6 and java ee 6
- integration with the java security model
the existing objects within the java security model like principal, subject, policy etc will be integrated within the api
- support for programmatic as well as annotation driven programming models
- leveraging contexts and dependency injection (cdi)
cdi will render services such as resource injection, life cycle callbacks and of course dependency injection of identity attributes and references within applications via qualifiers and producers
a brand new specification can often introduce terms or expressions which might sound vague or abstract at first. here is a list of keywords and concepts which are intimately attached to the java identity api. having a basic understanding of these terminologies is important
|entity||nothing but collection of ‘attributes ‘ e.g. a person can have attributes such as first name, last name, ssn, email etc.|
|attribute||it has a name (username, email), value (johndoe, email@example.com) and associated metadata (issuer, expiry)|
|entity reference||a secure handle for an entity|
|attribute reference||a secure , value independent handle to the attribute itself note : both entity and attribute references facilitate exchange without actually exposing the associated value|
|attribute repository||represents a set of contracts to be implemented in order to integrate with an identity source. contains the business logic to interact with the end identity repository|
|repository agent||it’s bound to a specific attribute repository and can be queried to provide a handle to the attribute repository it is attached to|
|repository descriptor||describes the relationship b/w a repository agent and the attribute repository which is bound to the agent|
|attribute provider||interacts with the repository agent and acts on its behalf to perform operations requested by the consumer|
|attribute service||it’s a service component which is exposed directly to the client application. it provides access to high level interfaces for interacting with and managing identities|
the java identity api is fairly lightweight and compact . the packages which form a part of the core programming interface have been highlighted below
|javax.security.identity||this package contains the identity attribute and reference types|
|javax.security.identity.annotations||contains annotations which help provide a portable identity programming model|
|javax.security.identity.auth||contains identity attribute and reference types for use in a java subject or accesscontrolcontext.|
|javax.security.identity.client||provide high-level programming interfaces to the identity attribute services.|
|javax.security.identity.client.expression||contains provider-independent expressions that are used to compose attribute queries.|
|javax.security.identity.client.qualifiers||defines annotations to be used as qualifiers in cdi injection of identity attributes.|
|javax.security.identity.permission||consists of the permission and actions values used to protect the interfaces of the attribute service.|
|javax.security.identity.provider||contains interfaces that are to be implemented by attribute providers and repository agents.|
some of the important annotations, interfaces and classes of the java identity api have been highlighted below
interfaces and classes
|attribute repository||javax.security.identity.provider. attributerepository|
high level overview of api usage
applications need access to underlying repositories to interact with them and perform operations. the below example outlines the sequence of steps highlighting the ways in which an application can leverage the api to obtain handles to the underlying identities and attributes
- concrete implementation of the javax.security.identity.client.lookupservice interface. this encapsulates the services of javax.security.identity.client.providerlookupservice and the javax.security.identity.provider.attributelookupservice
- an instance of the javax.security.identity.client.providerlookupcontext is obtained as a result of binding the lookupservice with an implementation of the javax.security.identity.provider.repositoryagent
- the providerlookupcontext is used to get a reference to javax.security.identity.provider.attributeprovider that is bound to the range of entities contained in the repository identified by the providerlookupcontext.
- the attributeprovider implementation is the gateway to the underlying identity repository and exposes crud like functionality via the javax.security.identity.provider.repositorylookupservice and javax.security.identity.provider.repositoryupdateservice
as with most java standards, jsr 351 has a reference implementation known as nobis. it provides implementations for
- javax.security.identity.client.lookupservice i.e. the providerlookupservice and attributelookupservice – to enable search/lookup identity attributes from the repository
- javax.security.identity.client.idpredicate – serves as a filtration/search criteria
as a part of the implementation, the nobis ri also provides
- post construct interceptors corresponding to the @javax.security.identity.annotations.identityprovider and @javax.security.identity.annotations.identity, which are nothing but interceptor bindings.
- a factory like api equivalent for above mentioned interceptors
- a sample implementation of facebook as an attribute provider along with jpa based and in-memory providers.
some things to look forward to
- how is the api going to evolve and attain final shape
- how will it be adopted by the community
- how would this be implemented and leveraged by products and real world applications
cheers . . . . ! ! :-)
Published at DZone with permission of Abhishek Gupta, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Merge GraphQL Schemas Using Apollo Server and Koa
Knowing and Valuing Apache Kafka’s ISR (In-Sync Replicas)
RAML vs. OAS: Which Is the Best API Specification for Your Project?
How To Use Geo-Partitioning to Comply With Data Regulations and Deliver Low Latency Globally