
How to use the Maven artifacts of the OpenID Federation Services, such as federation-starter, resolver-starter and resolver, in your own build.
Later versions are published only to the GitHub Packages Maven registry of this project:
https://maven.pkg.github.com/swedenconnect/openid-federation-services
The group IDs, artifact IDs and versions are the same as before. To move from 1.0.1 to 1.1.0 you add the repository and a token, as described below, and change the version.
Snapshot versions are not published.
GitHub Packages does not allow anonymous downloads, also not for public packages. Every build that downloads these artifacts must authenticate, a build from your terminal as well as one in CI.
Each developer, and each CI setup, uses its own token. No shared token is handed out.
Use a classic personal access token with the read:packages scope only. The GitHub Packages Maven registry accepts only classic tokens.
maven read packages, and an expiration date.read:packages scope, and nothing else.Any GitHub account can create such a token and download the packages, since the project is public.
Maven reads credentials from ~/.m2/settings.xml. Add a server with the id github. The id must be the same as the id of the repository in the POM.
Either with the token in the file:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
<servers>
<server>
<id>github</id>
<username>YOUR_GITHUB_USERNAME</username>
<password>YOUR_TOKEN</password>
</server>
</servers>
</settings>
Or read from environment variables, so that the token is not stored in the file:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
<servers>
<server>
<id>github</id>
<username>${env.GITHUB_USERNAME}</username>
<password>${env.GITHUB_PACKAGES_TOKEN}</password>
</server>
</servers>
</settings>
export GITHUB_USERNAME=your-github-username
export GITHUB_PACKAGES_TOKEN=your-token
The names of the environment variables are up to you, as long as the file and the environment agree.
Add the repository to the pom.xml of your project, with the same id, github:
<repositories>
<repository>
<id>github</id>
<name>Sweden Connect on GitHub Packages</name>
<url>https://maven.pkg.github.com/swedenconnect/*</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
The * at the end of the URL makes Maven install packages from any repository owned by swedenconnect, so this one entry, and the one server entry in settings.xml, also covers other Sweden Connect projects that publish to GitHub Packages.
Maven Central is still used for everything else. The dependencies themselves are declared as before, for example:
<dependency>
<groupId>se.swedenconnect.oidf</groupId>
<artifactId>resolver-starter</artifactId>
<version>1.1.0</version>
</dependency>
The token that GitHub gives a workflow, GITHUB_TOKEN, is meant for the repository the workflow runs in. Do not rely on it to download packages from this project. Use a classic personal access token with only read:packages instead, and store it as a secret in your repository or organization, for example as OIDF_PACKAGES_TOKEN.
actions/setup-java can write the server entry for you, with the values read from the environment:
- uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version: '25'
server-id: github
server-username: GITHUB_PACKAGES_USERNAME
server-password: GITHUB_PACKAGES_TOKEN
- name: Build
env:
GITHUB_PACKAGES_USERNAME: $
GITHUB_PACKAGES_TOKEN: $
run: mvn --no-transfer-progress clean verify
server-username and server-password name the environment variables to read, not the values.
Copyright © 2024-2026, Sweden Connect. Licensed under version 2.0 of the Apache License.