Code Monkey home page Code Monkey logo

spark-pac4j's Introduction

pac4j is an easy and powerful security framework for Java to authenticate users, get their profiles and manage authorizations in order to secure web applications and web services.

It provides a comprehensive set of concepts and components. It is available for most frameworks/tools and supports most authentication/authorization mechanisms. It is licensed under the Apache 2 license.

JDK pac4j Usage of Lombok
17 v6.x Yes
11 v5.x No
8 v4.x No

Available implementations (Get started by clicking on your framework):

JEESpring Web MVC (Spring Boot)Spring Webflux (Spring Boot)Apache ShiroSpring Security (Spring Boot)

CAS serverSyncopeApache Knox

Play 2.xVertxSpark JavaRatpackJAX-RSDropwizard

JavalinPippoUndertowLagomAkka HTTPJooby

Authentication mechanisms:

OAuth (Facebook, Twitter, Google...) - SAML - CAS - OpenID Connect - HTTP - Google App Engine - Kerberos (SPNEGO/Negotiate)

LDAP - SQL - JWT - MongoDB - CouchDB - IP address - REST API

Authorization mechanisms:

Roles - Anonymous/remember-me/(fully) authenticated - Profile type, attribute

CORS - CSRF - Security headers - IP address, HTTP method


Versions

The latest released version is the Maven Central, available in the Maven central repository. The next version is under development.

Read the documentation for more information.

Need help?

You can use the mailing lists or the commercial support.

Supported by

CAS in the cloud The CAS and pac4j consulting company

spark-pac4j's People

Contributors

atomfrede avatar jschwartz73 avatar leleuj avatar renovate[bot] avatar samchou19815 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spark-pac4j's Issues

Upgrade to pac4j v1.9

and all dependencies, Java 8...
Rename RequiresAuthenticationFilter as SecurityFilter

Request#body becomes blank when SecurityFilter added

Whenever I add a SecurityFilter to a path, the Request#body becomes blank. In fact, the entire Request object becomes uninitialized, and you have to use Request#raw to get the underlying HttpServletRequest.

Code:

HeaderClient headerClient = new HeaderClient("Authorization", jwtAuthenticator);
Clients clients = new Clients(headerClient);
Config config = new Config(clients);
config.setHttpActionAdapter(new DefaultHttpActionAdapter());
config.addAuthorizer("admin", new RequireAnyRoleAuthorizer<>("ROLE_ADMIN");

before(((request, response) -> log.trace("Received API Call: {} {}", request.requestMethod(), request.contextPath())));
before("/api/users/*", new SecurityFilter(config, "HeaderClient", "admin"));

post("/api/users", (request, response) -> {
    log.debug("Request body: {}", request.body()); // will show up as blank 
   // ... do something
});

RequiresAuthenticationFilter: Doc/Impl wrong; empty clientName

On the spark-pa4j README, it is stated that you can leave away the clientName parameter on the RequiresAuthenticationFilter:

clientName (optional): the list of client names (separated by commas) used for authentication. If the user is not authenticated, direct clients are tried successively then if the user is still not authenticated and if the first client is an indirect one, this client is used to start the authentication. Otherwise, a 401 HTTP error is returned. If the client_name request parameter is provided, only the matching client is selected

This is not how it is implemented: If you leave the clientName empty, all requests are prevented. This is due to the condition in the DefaultClientFinder.find which is called from RequiresAuthenticationFilter which will return an empty client-list if no client-name is specified.

Could someone clarify if this is
a) A documentation bug
b) An implementation bug

I'm currently searching for the feature to require an authentication without explicitly specifying a client and haven't found it.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-java v4
  • actions/cache v4
  • actions/checkout v4
  • actions/setup-java v4
maven
pom.xml
  • org.sonatype.oss:oss-parent 9
  • com.sparkjava:spark-core 2.9.4
  • org.pac4j:pac4j-javaee 5.7.3
  • org.apache.maven.plugins:maven-compiler-plugin 3.13.0
  • org.apache.maven.plugins:maven-source-plugin 3.3.1
  • org.apache.maven.plugins:maven-javadoc-plugin 3.6.3
  • com.github.spotbugs:spotbugs-maven-plugin 4.2.3
  • org.apache.maven.plugins:maven-pmd-plugin 3.21.2
  • org.apache.maven.plugins:maven-gpg-plugin 3.2.2

  • Check this box to trigger a request for Renovate to run again on this repository

Question on authn failures with LoginForm

I had a question on handling authn failures with the LoginForm.

For anyone else, I was using the request.params() rather than the correct request.queryParams( "error" ) method to retrieve the authn failure (which you can then use in the template rendering)

SAML message intended destination endpoint ERROR

The Spark-Pac4J library regarding SAML doesn't' seem to register correctly the callback URL when receiving the SAML Response.

The error I get is:

ERROR org.opensaml.common.binding.decoding.BaseSAMLMessageDecoder - SAML message intended destination endpoint 'https://localhost/callback?client_name=Saml2Client' did not match the recipient endpoint 'https://localhost/callback'

As described here: Pac4J-GoogleGroups.

ClassNotFound - ClassLoader

Hello, I'm Actually using Spark-Java with pac4j as a module on a module based application. Because the module does not have an own ClassLoader, the Class org.pac4j.core.profile.CommonProfile will not be found. Why? The Class is actually shaded into the module.

SecurityFilter wipes out request body

Whenever SecurityFilter is established (with indirect client configured) before an URL which is used, for example, to upload/put/post data it wipes request body after redirection loop is done (with FormClient).

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.