Basic Authentication Filter

Servlet filter for basic authentication. Useful for developing REST services without servlet-engine integration like Spring Boot

Лицензия

Лицензия

Группа

Группа

io.github.jdlopez
Идентификатор

Идентификатор

basicauthfilter
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Basic Authentication Filter
Servlet filter for basic authentication. Useful for developing REST services without servlet-engine integration like Spring Boot
Ссылка на сайт

Ссылка на сайт

https://github.com/jdlopez/basicauthfilter
Система контроля версий

Система контроля версий

https://github.com/jdlopez/basicauthfilter.git

Скачать basicauthfilter

Как подключить последнюю версию

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

Зависимости

provided (1)

Идентификатор библиотеки Тип Версия
javax.servlet : javax.servlet-api jar 3.1.0

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.13
org.mockito : mockito-core jar 3.2.4

Модули Проекта

Данный проект не имеет модулей.

Basic Authentication Filter for Java-Servlet

Very basic authentication filter. Suitable for Spring Boot REST services without servlet-engine configuration.

Configuration

Filter parameters could provide credentials repository

  • realm: Realm display name
  • credentialsFile: Credentials file, a properties file with user=pass. Could be external file or resource file. Checked in that order
  • one user-password: Use user and password parameters

No encription at all. Use with caution.

Usage

Add dependency to maven pom.xml:

<dependency>
    <groupId>io.github.jdlopez</groupId>
    <artifactId>basicauthfilter</artifactId>
    <version>1.0.0</version>
</dependency>

Add servlet filter and configure it. This is a spring-boot sample:

@Bean
public FilterRegistrationBean<es.jdl.web.BasicAuthenticationFilter> authFilter() {
    FilterRegistrationBean<es.jdl.web.BasicAuthenticationFilter> registrationBean
            = new FilterRegistrationBean<>();

    registrationBean.setFilter(new es.jdl.web.BasicAuthenticationFilter());
    registrationBean.addInitParameter("realm", "myapp");
    registrationBean.addInitParameter("user", "sampleuser");
    registrationBean.addInitParameter("password", "easypassword");
    registrationBean.addUrlPatterns("/rest/*");

    return registrationBean;
}

Aditional documentation

Basic Authentication specification: https://tools.ietf.org/html/rfc7617

Based in code found at: https://gist.github.com/neolitec/8953607

Tested using mockito:

Deploy to repository

mvn clean deploy -e -P ossrh

Версии библиотеки

Версия
1.0.0