Code Monkey home page Code Monkey logo

externalauthmodule's Introduction

ExternalAuthModule

This is an example of an External Auth module to be plugged into a Shibboleth Identity Provider.

It is a simple External Auth that does 2 things:

  1. GET: Redirect the User to a custom JSP webpage with a form for a username
  2. POST: Takes the username from the form and creates a Java Subject, setting the username as the Username Principal.

NOTE: Your custom webpage will need to match the file name that is in the GET method. Your form will also need to submit the correct parameter in the POST as well (userName in this instance).

Using the External Module

Create the jar and add to Shibboleth IDP

I recommend IntelliJ for this.

  1. Build Project
  2. File > Project Structure > Project Settings > Artifacts
  3. Hit the + > JAR > From project with dependencies > OK

(Next part is a bit tricky and something I don't know how to do yet via code/commands)

  1. Move your jar into a folder and run jar xf <JAR NAME>.jar
  2. Remove all files except for external/ExternalAuth.class and the META-INF/MANIFEST.MF. There is an example jar directory example-jar-directory. Instead of removing files you can also just add the necessary ones into a new folder.
  3. Jar it back up with a name jar cvf <JAR NAME>.jar -C <FOLDER-NAME>/ .

Shibboleth IDP config

Make sure authn/External bean is enabled in general-authn.xml and that the external-authn-config.xml is present.

Make sure your JSP webpage is in webapp/ directory.

In web.xml, add the following servlet:

<!-- Servlet for receiving a callback from an external Server and continues the IdP login flow -->
 <servlet>
    <servlet-name>ExternalAuth</servlet-name>
    <servlet-class>external.ExternalAuth</servlet-class>
    <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>ExternalAuth</servlet-name>
    <url-pattern>/Authn/External/*</url-pattern>
</servlet-mapping>

Route some auth flows through the External Module

externalauthmodule's People

Contributors

harrycguo avatar

Watchers

 avatar  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.