Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
com.auth0:mvc-auth-commons
Advanced tools
Java library that simplifies the use of Auth0 for server-side MVC web apps
Note As part of our ongoing commitment to best security practices, we have rotated the signing keys used to sign previous releases of this SDK. As a result, new patch builds have been released using the new signing key. Please upgrade at your earliest convenience.
While this change won't affect most developers, if you have implemented a dependency signature validation step in your build process, you may notice a warning that past releases can't be verified. This is expected, and a result of the key rotation process. Updating to the latest version will resolve this for you.
:books: Documentation - :rocket: Getting Started - :computer: API Reference :speech_balloon: Feedback
Java 8 or above and javax.servlet
version 3.
If you are using Spring, we recommend leveraging Spring's OIDC and OAuth2 support, as demonstrated by the Spring Boot Quickstart.
Add the dependency via Maven:
<dependency>
<groupId>com.auth0</groupId>
<artifactId>mvc-auth-commons</artifactId>
<version>1.11.0</version>
</dependency>
or Gradle:
implementation 'com.auth0:mvc-auth-commons:1.11.0'
Create a Regular Web Application in the Auth0 Dashboard. Verify that the "Token Endpoint Authentication Method" is set to POST
.
Next, configure the callback and logout URLs for your application under the "Application URIs" section of the "Settings" page:
http://localhost:3000/callback
.http://localhost:3000/login
.Note the Domain, Client ID, and Client Secret. These values will be used later.
Create a new AuthenticationController
using your Auth0 domain, and Auth0 application client ID and secret.
Configure the builder with a JwkProvider
for your Auth0 domain.
public class AuthenticationControllerProvider {
private String domain = "YOUR-AUTH0-DOMAIN";
private String clientId = "YOUR-CLIENT-ID";
private String clientSecret = "YOUR-CLIENT-SECRET";
private AuthenticationController authenticationController;
static {
JwkProvider jwkProvider = new JwkProviderBuilder("YOUR-AUTH0-DOMAIN").build();
authenticationController = AuthenticationController.newBuilder(domain, clientId, clientSecret)
.withJwkProvider(jwkProvider)
.build();
}
public getInstance() {
return authenticationController;
}
}
Note: The
AuthenticationController.Builder
is not to be reused, and anIllegalStateException
will be thrown ifbuild()
is called more than once.
Redirect users to the Auth0 login page using the AuthenticationController
:
@WebServlet(urlPatterns = {"/login"})
public class LoginServlet extends HttpServlet {
@Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
// Where your application will handle the authoriztion callback
String redirectUrl = "http://localhost:3000/callback";
String authorizeUrl = AuthenticationControllerProvider
.getInstance()
.buildAuthorizeUrl(req, res, redirectUrl)
.build();
res.sendRedirect(authorizeUrl);
}
}
Finally, complete the authentication and obtain the tokens by calling handle()
on the AuthenticationController
.
@WebServlet(urlPatterns = {"/callback"})
public class CallbackServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
try {
// authentication complete; the tokens can be stored as needed
Tokens tokens = AuthenticationControllerProvider
.getInstance()
.handle(req, res);
res.sendRedirect("URL-AFTER-AUTHENTICATED");
} catch (IdentityVerificationException e) {
// handle authentication error
}
}
}
That's it! You have authenticated the user using Auth0.
We appreciate feedback and contribution to this repo! Before you get started, please see the following:
To provide feedback or report a bug, please raise an issue on our issue tracker.
Please do not report security vulnerabilities on the public Github issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout Why Auth0?
This project is licensed under the MIT license. See the LICENSE file for more info.
FAQs
Unknown package
We found that com.auth0:mvc-auth-commons demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.