Skip to content

Commit

Permalink
Merge branch 'main' into feature/oauth-logging-docu
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Aug 29, 2024
2 parents 2b3513d + 1123960 commit b3c8f93
Show file tree
Hide file tree
Showing 243 changed files with 1,661 additions and 3,158 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ jobs:
# Actually we need to resolve it regarding https://maven.apache.org/plugins/maven-javadoc-plugin/examples/aggregate.html
run: |
git checkout -b release
mvn -B --no-transfer-progress -Prelease release:clean release:prepare -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} -Dmaven.javadoc.skip=true
mvn -B --no-transfer-progress -Prelease,javadoc-mm-reporting release:clean release:prepare -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}}
mvn -B --no-transfer-progress -Prelease site:site site:stage -Dmaven.javadoc.skip=true
git checkout ${{vars.GITHUB_BASE_REF}}
git rebase release
mvn -B --no-transfer-progress -Prelease release:perform -DskipTests -Dmaven.javadoc.skip=true
mvn -B --no-transfer-progress -Prelease,javadoc-mm-reporting release:perform -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSS_SONATYPE_PASSWORD }}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ jobs:

- name: Deploy Snapshot with Maven, version ${{ steps.project.outputs.version }}
if: ${{endsWith(steps.project.outputs.version, '-SNAPSHOT')}}
# javadoc:aggregate -> Needs to be fixed: "Error: No source files for package de.cuioss.jsf.api.components.model"
# Actually we need to resolve it regarding https://maven.apache.org/plugins/maven-javadoc-plugin/examples/aggregate.html
run: |
mvn -B --no-transfer-progress -Prelease-snapshot install -Dmaven.javadoc.skip=true
mvn -B --no-transfer-progress -Prelease-snapshot deploy -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
mvn -B --no-transfer-progress -Prelease-snapshot,javadoc-mm-reporting install
mvn -B --no-transfer-progress -Prelease-snapshot deploy -Dmaven.javadoc.skip=true -Dmaven.test.skip=true
env:
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSS_SONATYPE_PASSWORD }}
Expand Down
23 changes: 13 additions & 10 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,27 @@ https://cuioss.github.io/cui-portal-core/about.html[Generated Documentation on g

== What is it?

The core modules of the cui-portal incorporating portal-configuration and portal authentication
The core modules of the cui-portal incorporate portal-configuration and portal-authentication mechanisms and some more ...

=== Maven Coordinates

[source,xml]
----
<dependency>
<groupId>de.cuioss.portal</groupId>
<artifactId>cui-portal-core</artifactId>
</dependency>
<dependency>
<groupId>de.cuioss.portal</groupId>
<artifactId>bom</artifactId>
<version>1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
----

== Features / Modules

=== Credentials
link:modules/authentication/[portal-authentication]

A sonar token can be derived from https://sonarcloud.io/account/security
link:modules/core/[portal-core]

=== Further Steps
link:modules/micro-profile/[micro-profile]

* `src/site/asciidoc/about.adoc`: Adjust content
* Review / Add Collaborators
link:modules/test/portal-core-unit-testing[portal-core-unit-testing]
20 changes: 7 additions & 13 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@
<description>BOM for the portal-core-modules</description>
<dependencyManagement>
<dependencies>
<!-- Configuration-->
<dependency>
<groupId>de.cuioss.portal.configuration</groupId>
<artifactId>portal-configuration-api</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>de.cuioss.portal.configuration</groupId>
<artifactId>portal-configuration-impl</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Authentication-->
<dependency>
<groupId>de.cuioss.portal.authentication</groupId>
Expand All @@ -51,6 +38,13 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<!-- Configuration-->
<dependency>
<groupId>de.cuioss.portal.core</groupId>
<artifactId>portal-configuration</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<!-- Portal-Common-->
<dependency>
<groupId>de.cuioss.portal.core</groupId>
Expand Down
34 changes: 34 additions & 0 deletions modules/authentication/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
= portal-authentication

== What is it?

Groups all modules providing authentication and authorization for the cuioss-portal.

Within your code, you usually interact with types from link:portal-authentication-api/[portal-authentication-api].

It is assumed that at least one of the runtime modules is available:

* link:portal-authentication-oauth/[portal-authentication-oauth]: Default implementation for integrating against oauth2 / OICD.

* link:portal-authentication-dummy/[portal-authentication-dummy]:
Implementation for cases where it is only needed technically.
The implementation will always return a not-authenticated UserInfo.
In contrast to 'link:portal-authentication-mock/[portal-authentication-mock]' this module can be used in production environments.

* link:portal-authentication-mock/[portal-authentication-mock]:
Implementation for cases where it is only needed technically or for documentation purpose.
In contrast to 'portal-authentication-dummy' this module must never be used in production environments.

== Usage

The central object ist the `@Dependent`-scoped `AuthenticatedUserInfo`
that has a number of methods interacting with the logged-in user.

[source,java]
----
@Inject
private AuthenticatedUserInfo userProvider;
----

See link:portal-authentication-api/[portal-authentication-api] for more details
6 changes: 1 addition & 5 deletions modules/authentication/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>de.cuioss.portal.configuration</groupId>
<artifactId>portal-configuration-impl</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-junit5</artifactId>
Expand Down
28 changes: 28 additions & 0 deletions modules/authentication/portal-authentication-api/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
= portal-authentication-api

== What is it?
Provides types for handling authentication and authorization related information within the cui-portal.
It is meant as an abstraction over different ways of authentication and authorization,
see link:../[portal-authentication] for the different runtimes.

== Maven Coordinates

[source, xml]
----
<dependency>
<groupId>de.cuioss.portal.authentication</groupId>
<artifactId>portal-authentication-api</artifactId>
</dependency>
----

== Usage

The central object ist the `@Dependent`-scoped `AuthenticatedUserInfo`
that has a number of methods interacting with the logged-in user.

[source,java]
----
@Inject
private AuthenticatedUserInfo userProvider;
----
55 changes: 30 additions & 25 deletions modules/authentication/portal-authentication-api/pom.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.cuioss.portal.authentication</groupId>
<artifactId>authentication</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>portal-authentication-api</artifactId>
<name>Portal Authentication API</name>
<description>Api for the different way of authentication within the portal</description>
<properties>
<maven.jar.plugin.automatic.module.name>
de.cuioss.portal.authentication.api</maven.jar.plugin.automatic.module.name>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
</dependencies>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.cuioss.portal.authentication</groupId>
<artifactId>authentication</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>portal-authentication-api</artifactId>
<name>Portal Authentication API</name>
<description>Api for the different way of authentication within the portal</description>
<properties>
<maven.jar.plugin.automatic.module.name>
de.cuioss.portal.authentication.api
</maven.jar.plugin.automatic.module.name>
</properties>
<dependencies>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>de.cuioss.portal.core</groupId>
<artifactId>portal-common-cdi</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@
// (coherence).
public interface AuthenticatedUserInfo extends Serializable {

/**
* Bean name for looking up instances.
*
* @deprecated owolff: Should solely be used with types
*/
@Deprecated(forRemoval = true)
String BEAN_NAME = "authenticatedUserInfoBean";

/**
* Returns <code>true</code> in case of user is authenticated already and
* <code>false</code> otherwise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
*/
package de.cuioss.portal.authentication;

import java.io.Serial;
import java.io.Serializable;

import lombok.Builder;
import lombok.NonNull;
import lombok.Value;

import java.io.Serial;
import java.io.Serializable;

/**
* To signal successful / failed login and logout events (e.g. to the atna
* logger).
* To signal successful / failed login and logout events (e.g., to the audit-logger).
*/
@Value
@Builder
Expand All @@ -37,18 +36,24 @@ public class LoginEvent implements Serializable {
* Identifies the concrete action that was executed
*/
public enum Action {
/** Login was successful. */
/**
* Login was successful.
*/
LOGIN_SUCCESS,

/** Login failed. */
/**
* Login failed.
*/
LOGIN_FAILED,
/** User logged out. */
/**
* User logged out.
*/
LOGOUT
}

// Only needed for LOGIN_FAILED
private String username;
String username;

@NonNull
private Action action;
Action action;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,23 @@
*/
package de.cuioss.portal.authentication;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import jakarta.inject.Qualifier;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import jakarta.inject.Qualifier;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* Defines events that will be fired at login attempt. The payload is
* {@link LoginEvent}.
* Defines events that will be fired at a login attempt.
* The payload is {@link LoginEvent}.
*
* @author Matthias Walliczek
*/
@Qualifier
@Retention(RUNTIME)
@Target({ TYPE, METHOD, FIELD, PARAMETER })
@Target({TYPE, METHOD, FIELD, PARAMETER})
public @interface PortalLoginEvent {

}

This file was deleted.

Loading

0 comments on commit b3c8f93

Please sign in to comment.