Shiro Authorizing Realm for Azure AD

Shiro realm implementation for authenticating users against Azure AD and authorization with groups and roles from the Graph API.

License

License

GroupId

GroupId

com.nitorcreations
ArtifactId

ArtifactId

shiro-aad
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Shiro Authorizing Realm for Azure AD
Shiro realm implementation for authenticating users against Azure AD and authorization with groups and roles from the Graph API.
Project URL

Project URL

https://github.com/NitorCreations/shiro-aad
Source Code Management

Source Code Management

https://github.com/NitorCreations/shiro-aad

Download shiro-aad

How to add to project

<!-- https://jarcasting.com/artifacts/com.nitorcreations/shiro-aad/ -->
<dependency>
    <groupId>com.nitorcreations</groupId>
    <artifactId>shiro-aad</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.nitorcreations/shiro-aad/
implementation 'com.nitorcreations:shiro-aad:1.0.1'
// https://jarcasting.com/artifacts/com.nitorcreations/shiro-aad/
implementation ("com.nitorcreations:shiro-aad:1.0.1")
'com.nitorcreations:shiro-aad:jar:1.0.1'
<dependency org="com.nitorcreations" name="shiro-aad" rev="1.0.1">
  <artifact name="shiro-aad" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.nitorcreations', module='shiro-aad', version='1.0.1')
)
libraryDependencies += "com.nitorcreations" % "shiro-aad" % "1.0.1"
[com.nitorcreations/shiro-aad "1.0.1"]

Dependencies

compile (9)

Group / Artifact Type Version
com.microsoft.azure : adal4j jar 1.0.0
com.google.code.gson : gson jar 2.3.1
ch.qos.logback : logback-core jar 1.1.3
ch.qos.logback : logback-classic jar 1.1.3
org.slf4j : jcl-over-slf4j jar 1.7.9
org.slf4j : log4j-over-slf4j jar 1.7.9
org.slf4j : jul-to-slf4j jar 1.7.9
org.slf4j : slf4j-jdk14 jar 1.7.9
org.apache.shiro : shiro-core jar 1.2.3

Project Modules

There are no modules declared in this project.

shiro-aad

Apache Shiro authentication and authorization realm for Azure Active Directory (AAD)

This is a Shiro authentication and authorization realm for Azure Active Directory (AAD).

It uses the adal4j library for authentication and the Graph API for retrieving authorization data i.e. group and role memberships.

Azure management

In order to provide the realm access to your Azure directory, you must configure two applications for your directory in the Azure management console:

  • One "native" type application for doing the authentication. Only a Client ID is possible for a "native" application.

  • One "web" application for doing the authorization. For a "web" application you'll have both a Client ID and a Client Secret (which you must create in the Azure management console).

Configuration

There are several ways to configure the AAD realm.

To configure the realm using the standard Shiro "ini" file mechanism, you'll need to create the configuration object, set any of its properties, then create the realm itself and set the configuration to it. For example, something like the following in shiro.ini:

[main]
aadRealmConfig = com.nitorcreations.willow.shiro.aad.AADRealmConfig
aadRealmConfig.authority = https://login.windows.net/
aadRealmConfig.tenant = contoso.onmicrosoft.com
aadRealmConfig.graphResource = https://graph.windows.net/
aadRealmConfig.authenticationClientId = 12345678-abcd-5678-4567-889900122334
aadRealmConfig.authorizationClientId = 98765432-4321-abcd-abcd-8899aabcdcdd
aadRealmConfig.authorizationClientSecret = 8FnpGBmR4Do8GB4BbumFtGvZwKdBbjKsrWr2QsS3k/w=

myRealm = com.nitorcreations.willow.shiro.aad.AADRealm
myRealm.config = $aadRealmConfig

Alternatively, the AADRealm object can be created completely programmatically and the properties of the AADRealmConfig be set explicitly. It is also possible to load the properties of the AADRealmConfig from a Properties file or using Shiro's ResourceUtils.getInputStreamForPath() mechanism.

com.nitorcreations

Nitor Creations

Versions

Version
1.0.1
1.0