Skip to content

Commit

Permalink
Merge branch 'release/0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanzilske committed May 2, 2023
2 parents 25d1b43 + 83b255e commit 35575b4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@

*Auto-login feature for development*

[![stable](https://img.shields.io/badge/lifecycle-STABLE-green.svg)](https://github.com/holisticon#open-source-lifecycle)
[![Build Status](https://github.com/holunda-io/camunda-platform-7-autologin/workflows/Development%20branches/badge.svg)](https://github.com/holunda-io/camunda-platform-7-autologin/actions)
[![sponsored](https://img.shields.io/badge/sponsoredBy-Holisticon-RED.svg)](https://holisticon.de/)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.holunda/camunda-platform-7-autologin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/holunda-io/camunda-platform-7-autologin)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.holunda/camunda-platform-7-autologin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.holunda/camunda-platform-7-autologin)
![Compatible with: Camunda Platform 7](https://img.shields.io/badge/Compatible%20with-Camunda%20Platform%207-26d07c)

## Why should you use it?

Because otherwise, you need to type again and again "admin/admin" or "demo/demo" when developing locally and trying to log-in to local Camunda Webapp.

## Main Features
## Feature

Allows auto-login by the user configured in the properties.
Allows Camunda WebApp auto-login by the user configured in the application properties.

## Usage

Put the following dependency on your classpath:
Assuming you are using Camunda Spring Boot Starter, put the following dependency on your classpath:

```xml
<dependency>
Expand Down Expand Up @@ -49,9 +50,10 @@ camunda:
login:
enabled: true # enables the feature, disabled by default
user-id: admin # user id of the user, defaults to 'nobody'
camunda-context-path: /some-path # path camunda webapp bound to, defaults to /camunda
create-if-absent: true # will create a dummy user using internal identity service, defaults to false
random-password: false # flag to control the password of the auto-generated-user, defaults to true. If false is selected, the password is equals to user id.
camunda-context-path: /some-path # path camunda webapp bound to, defaults to '/camunda'
create-if-absent: true # will create a dummy user using internal identity service, defaults to 'false'
random-password: false # flag to control the password of the auto-generated-user, defaults to 'true'.
# If false is selected, the password is equals to user id.
```

## License
Expand All @@ -62,6 +64,4 @@ This library is developed under Apache 2.0 License.

## Contribution

If you want to contribute to this project, feel free to do so.
Start with [Contributing guide](http://holunda.io/camunda-bpm-correlate/snapshot/developer-guide/contribution.html).
If you are missing a feature, you are welcome to contribute by filing an issue or providing a pull-request.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>io.holunda</groupId>
<artifactId>camunda-platform-7-autologin</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<url>https://github.com/holunda-io/camunda-platform-7-autologin/</url>
Expand All @@ -15,7 +15,7 @@
<java.version>11</java.version>
<kotlin.version>1.6.21</kotlin.version>
<spring-boot.version>2.6.7</spring-boot.version>
<camunda.version>7.17.0</camunda.version>
<camunda.version>7.19.0</camunda.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.holunda.camunda.platform.login

import org.camunda.bpm.engine.rest.security.auth.AuthenticationProvider
import org.camunda.bpm.webapp.impl.security.auth.AuthenticationService
import org.camunda.bpm.webapp.impl.security.auth.ContainerBasedAuthenticationFilter
import javax.servlet.FilterConfig

Expand All @@ -14,6 +13,5 @@ open class ExtendedContainerBasedAuthenticationFilter(

override fun init(filterConfig: FilterConfig) {
super.authenticationProvider = provider
super.userAuthentications = AuthenticationService()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.holunda.camunda.platform.login
import org.camunda.bpm.engine.ProcessEngine
import org.camunda.bpm.engine.rest.security.auth.AuthenticationProvider
import org.camunda.bpm.engine.rest.security.auth.AuthenticationResult
import org.camunda.bpm.webapp.impl.security.auth.AuthenticationUtil
import org.camunda.bpm.webapp.impl.security.auth.Authentications
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
Expand All @@ -19,7 +20,7 @@ class SessionBasedAuthenticationProvider(
}

override fun extractAuthenticatedUser(request: HttpServletRequest, processEngine: ProcessEngine): AuthenticationResult {
val authentications = Authentications.getFromSession(request.session)
val authentications = AuthenticationUtil.getAuthsFromSession(request.session)
val userId = if (authentications != null && authentications.hasAuthenticationForProcessEngine(processEngine.name)) {
authentications.getAuthenticationForProcessEngine(processEngine.name).name
} else {
Expand Down

0 comments on commit 35575b4

Please sign in to comment.