GithubHelp home page GithubHelp logo

isabella232 / okta-shiro-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oktadev/okta-shiro-plugin

0.0 0.0 0.0 431 KB

A library for integrating Okta into Apache Shiro based projects

License: Apache License 2.0

Shell 30.72% Java 31.93% Groovy 37.35%

okta-shiro-plugin's Introduction

Maven Central License

Okta Shiro Plugin

This repository contains a Shiro Realm for Okta, for use with OAuth 2.0 Resource Servers. This realm will validate Okta JWT access tokens.

We also publish these libraries for Java:

You can learn more on the Okta + Java page in our documentation.

Release status

This library uses semantic versioning and follows Okta's library version policy.

โœ”๏ธ The current stable major version series is: 1.x

Version Status
0.x.0 Beta

The latest release can always be found on the releases page.

Need help?

If you run into problems using this project, you can

Getting started

To use this Shiro (1.5+) realm you will need to include the following dependency:

For Apache Maven:

<dependency>
    <groupId>com.okta.shiro</groupId>
    <artifactId>okta-shiro-plugin</artifactId>
    <version>${okta.shiro.version}</version>
</dependency>

For Gradle:

runtime "com.okta.shiro:okta-shiro-plugin:${okta.shiro.version}"

SNAPSHOT Dependencies

Snapshots are deployed off of the 'master' branch to OSSRH and can be consumed using the following repository configured for Apache Maven or Gradle:

https://oss.sonatype.org/content/repositories/snapshots/

You'll also need:

  • An Okta account, called an organization (sign up for a free developer organization if you need one)
  • Another application configured to send access tokens to the project using this plugin. You could use Spring Cloud Gateway

Usage guide

This plugin provides a Shiro Realm that will authenticate requests with an Authorization: Bearer <access-token> header.

To use the realm, first define and configure the OktaResourceServerRealm

[main]
# define the realm
oktaRealm = com.okta.shiro.realm.OktaResourceServerRealm

# Set the issuer to your Okta org
oktaRealm.issuer = https://{yourOktaDomain}/oauth2/default

# Additionally, you can override the following default values
oktaRealm.audience = "api://default"
oktaRealm.groupClaim = "groups"
oktaRealm.nameClaim = "sub"

[urls]
# You must use the `authcBearer` filer to parse access token from the `Authorization` header
/** = authcBearer

The JWT claim information can be retrieved from the current Shiro Subject by casting the principal to OktaJwtPrincipal:

import com.okta.shiro.OktaJwtPrincipal;
...

OktaJwtPrincipal jwtPrincipal = (OktaJwtPrincipal) SecurityUtils.getSubject().getPrincipal();

See the examples to help you get started even faster:

Building the Project

In most cases, you won't need to build this project from source. If you want to build it yourself, just clone the repo and run:

./mvnw install

Contributing

We're happy to accept contributions and PRs! Please see the contribution guide to understand how to structure a contribution.

okta-shiro-plugin's People

Contributors

bdemers avatar bmarwell avatar dependabot[bot] avatar mraible avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.