Compare commits

..

8 commits

Author SHA1 Message Date
d38c4ab6a6 Add flag default-to-user-email
All checks were successful
/ Verify (pull_request) Successful in 53s
When set for an export config, if the user doesn't have that attribute, their email will be substituted as a default. If any of the values is not a valid email address, they are filtered out.

Closes #29
2026-07-21 21:56:53 +02:00
c6f7d2f335 Add exporting individual attributes and a map endpoint (#26)
All checks were successful
/ Verify (push) Successful in 51s
Based off #32

Also:
* rework README.md
* improve configuration error messages

Closes #22

Reviewed-on: #26
Reviewed-by: June <june@noreply.git.hamburg.ccc.de>
2026-07-21 21:47:24 +02:00
510c045070 Formatting
All checks were successful
/ Verify (pull_request) Successful in 52s
/ Verify (push) Successful in 46s
2026-07-21 21:20:15 +02:00
218ee1dd57 Add just the refactoring from #26.
All checks were successful
/ Verify (pull_request) Successful in 45s
This is based off #31, so that needs to be merged first.
2026-07-19 13:21:57 +02:00
f204ab7f28 Add just the testing setup from #26.
All checks were successful
/ Verify (pull_request) Successful in 1m12s
/ Verify (push) Successful in 53s
Important: there are changes here to adapt the tests and the Keycloak test realm that are incompatible with the changes in #29. Ultimately, the changes in #29 need to be applied over this.
2026-07-19 10:27:51 +02:00
6cd678b414 Spell option correctly
All checks were successful
/ Verify (push) Successful in 45s
2026-07-18 21:41:42 +02:00
89ce38f6c1 Be less verbose when building
Some checks failed
/ Verify (push) Failing after 17s
2026-07-18 21:40:39 +02:00
0a84d2ddf9 Only build when pushing to main
All checks were successful
/ Verify (push) Successful in 46s
or on a pull request
2026-07-18 21:38:50 +02:00
5 changed files with 27 additions and 27 deletions

View file

@ -1,10 +1,12 @@
on: on:
pull_request: pull_request:
push: push:
branches:
- main
jobs: jobs:
test: ansible-lint:
name: Test name: Verify
runs-on: docker runs-on: docker
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v7
@ -12,6 +14,6 @@ jobs:
run: | run: |
apt update apt update
apt install -y maven apt install -y maven
- name: Run maven verify test - name: Run maven verify
run: | run: |
mvn -f attribute-endpoints-provider verify test mvn -f attribute-endpoints-provider --batch-mode --no-transfer-progress verify

View file

@ -1,7 +1,7 @@
# Attribute Endpoints Provider - Export User Attributes # Attribute Endpoints Provider - Export User Attributes
This is a Keycloak Provider that exports user profile attribute values. This is a Keycloak Provider that exports user profile attribute values.
The selection of attributes and authorization is manage through an endpoint configuration. The selection of attributes and authorization is managed through an endpoint configuration in the Keycloak admin website.
## Usage ## Usage
@ -43,7 +43,7 @@ Once all dependencies are met, simply call `make` to build the provider, which s
There's also `make clean` available for removing the output directory. There's also `make clean` available for removing the output directory.
To add the provider to your Keycloak install, copy `attribute-endpoints-provider/target/attribute-endpoints-provider-1.0-SNAPSHOT.jar` to the Keycloak Provider directory (`/opt/keycloak/providers/). To add the provider to your Keycloak install, copy `attribute-endpoints-provider/target/attribute-endpoints-provider-1.0-SNAPSHOT.jar` to the Keycloak Provider directory (`/opt/keycloak/providers/`).
## Testing Setup ## Testing Setup

View file

@ -128,6 +128,7 @@ public class AdminUiPage implements UiPageProvider, UiPageProviderFactory<Compon
.add() .add()
.property() .property()
// keep old name for backwards compatibility
.name("attribute-group") .name("attribute-group")
.label("Attribute Name or Group") .label("Attribute Name or Group")
.helpText("The attribute or attribute group to export.") .helpText("The attribute or attribute group to export.")

View file

@ -1,36 +1,35 @@
package de.ccc.hamburg.keycloak.attribute_endpoints; package de.ccc.hamburg.keycloak.attribute_endpoints;
import com.google.auto.service.AutoService;
import org.keycloak.Config; import org.keycloak.Config;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory; import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.services.resource.RealmResourceProvider; import org.keycloak.services.resource.RealmResourceProvider;
import org.keycloak.services.resource.RealmResourceProviderFactory; import org.keycloak.services.resource.RealmResourceProviderFactory;
import com.google.auto.service.AutoService;
@AutoService(RealmResourceProviderFactory.class) @AutoService(RealmResourceProviderFactory.class)
public class AttributeEndpointsResourceProviderFactory implements RealmResourceProviderFactory { public class AttributeEndpointsResourceProviderFactory implements RealmResourceProviderFactory {
static final String PROVIDER_ID = "attribute-endpoints-provider"; static final String PROVIDER_ID = "attribute-endpoints-provider";
@Override @Override
public RealmResourceProvider create(KeycloakSession keycloakSession) { public RealmResourceProvider create(KeycloakSession keycloakSession) {
return new AttributeEndpointsResourceProvider(keycloakSession); return new AttributeEndpointsResourceProvider(keycloakSession);
} }
@Override @Override
public void init(Config.Scope config) { public void init(Config.Scope config) {
} }
@Override @Override
public void postInit(KeycloakSessionFactory keycloakSessionFactory) { public void postInit(KeycloakSessionFactory keycloakSessionFactory) {
} }
@Override @Override
public void close() { public void close() {
} }
@Override @Override
public String getId() { public String getId() {
return PROVIDER_ID; return PROVIDER_ID;
} }
} }

View file

@ -24,9 +24,7 @@ import java.util.Map;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.stream.Stream; import java.util.stream.Stream;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.*; import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;