Skip to content

Commit

Permalink
Initial changes to project
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Feb 9, 2024
1 parent 2d7b4f9 commit 3f90911
Show file tree
Hide file tree
Showing 10 changed files with 383 additions and 225 deletions.
11 changes: 11 additions & 0 deletions .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.6.1))
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
27 changes: 8 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
# ADempiere Template Project
# ADempiere Open-ID Connector

Fill it with a comment about project.
A connector to generic Open-ID services like Keycloak or Okta, this project is a temporary solution meanwhile is approved [this](https://github.com/adempiere/adempiere/pull/4284) pull request

## Requirements
- [JDK 11 or later](https://adoptium.net/)
- [Gradle 8.0.1 or later](https://gradle.org/install/)


### Packages Names
you should change the follows packages for your own implementation, just change the word `template` by your implementation
This is a little project to use the generic providers as library and just have one package `org.spin.authentication.services.addons.provider`

```Java
org.spin.template.model.validator
org.spin.template.setup
org.spin.template.util
```

### Model Validators
Change the `org.spin.template.model.validator.Validator` by your implementation, example: `org.spin.template.model.validator.MyOwnFunctionality`

### Model Deploy class
Change the `org.spin.template.setup.Deploy` by your implementation, example: `org.spin.template.setup.MyOwnSetupForDeploy`

### Model Util class for core changes
Change the `org.spin.template.util.Changes` by your implementation, example: `org.spin.template.util.MyOwnChanges`
The unique class for handle the generic connection is `org.spin.authentication.services.addons.provider.GenericAuthentication`

## Binary Project

You can get all binaries from github [here](https://central.sonatype.com/artifact/io.github.adempiere/adempiere-template-project/1.0.0).
You can get all binaries from github [here](https://central.sonatype.com/artifact/io.github.adempiere/adempiere-open-id-connector/1.0.0).

All contruction is from github actions

Expand All @@ -44,21 +33,21 @@ Is very easy.
- Gradle

```Java
implementation 'io.github.adempiere:adempiere-template-project:1.0.0'
implementation 'io.github.adempiere:adempiere-open-id-connector:1.0.0'
```

- SBT

```
libraryDependencies += "io.github.adempiere" % "adempiere-template-project" % "1.0.0"
libraryDependencies += "io.github.adempiere" % "adempiere-open-id-connector" % "1.0.0"
```

- Apache Maven

```
<dependency>
<groupId>io.github.adempiere</groupId>
<artifactId>adempiere-template-project</artifactId>
<artifactId>adempiere-open-id-connector</artifactId>
<version>1.0.0</version>
</dependency>
```
13 changes: 7 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
)
// ADempiere Core
api "${baseGroupId}:base:${baseVersion}"
api "${baseGroupId}:openid-authentication:${baseVersion}"
}

sourceSets {
Expand Down Expand Up @@ -73,12 +74,12 @@ publishing {
publications {
mavenJava(MavenPublication) {
groupId = group
artifactId = 'adempiere-template-project'
artifactId = 'adempiere-open-id-connector'
version = version
from components.java
pom {
name = 'ADempiere Template Project'
description = 'Fill it with project description'
name = 'ADempiere Open-ID Connector'
description = 'A connector to generic Open-ID services like Keycloak or Okta'
url = 'http://adempiere.io/'
licenses {
license {
Expand All @@ -94,9 +95,9 @@ publishing {
}
}
scm {
connection = 'scm:git:git://github.com/adempiere/adempiere-template-project.git'
developerConnection = 'scm:git:ssh://github.com/adempiere/adempiere-template-project.git'
url = 'http://github.com/adempiere/adempiere-template-project'
connection = 'scm:git:git://github.com/adempiere/adempiere-open-id-connector.git'
developerConnection = 'scm:git:ssh://github.com/adempiere/adempiere-open-id-connector.git'
url = 'http://github.com/adempiere/adempiere-open-id-connector'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'adempiere-template-project'
rootProject.name = 'adempiere-open-id-connector'
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Copyright (C) 2003-2015 E.R.P. Consultores y Asociados, C.A. *
* All Rights Reserved. *
* Contributor(s): Carlos Parada www.erpya.com *
*****************************************************************************/
package org.spin.authentication.services.addons.provider;

import java.util.Optional;
import org.spin.authentication.services.OpenIDConnect;
import org.spin.model.MADAppRegistration;
import com.nimbusds.oauth2.sdk.ResponseType;

/**
* @author Carlos Parada, cparada@erpya.com, ERPCyA http://www.erpya.com
* Add support to login with Generic Open ID service
*/
public class GenericAuthentication extends OpenIDConnect{

/**Default Scope*/
private final static String defaultScope = "openid,email,profile";
/**Authorization End point Tag*/
private static final String AUTHORIZATION_ENDPOINT_TAG = "AUTHORIZATION_ENDPOINT";
/**Token End point Tag*/
private static final String TOKEN_ENDPOINT_TAG = "TOKEN_ENDPOINT";
/**User Info End point Tag*/
private static final String USERINFO_ENDPOINT_TAG = "USERINFO_ENDPOINT";
/**Scope Parameter*/
private static final String PARAMETER_SCOPE = "SCOPE";
/**
* Constructor
*/
public GenericAuthentication() {
super();
setResponseType(new ResponseType(ResponseType.Value.CODE));
}

/***
* Set Default values from Application Registration
*/
@Override
public void setAppRegistrationId(int registrationId) {
super.setAppRegistrationId(registrationId);
Optional<MADAppRegistration> maybeApRegistration = Optional.ofNullable(getApplicationRegistration());
maybeApRegistration.ifPresent(appRegistration -> {
String authorizationEndPoint = Optional.ofNullable(appRegistration.getParameterValue(AUTHORIZATION_ENDPOINT_TAG)).orElse("");
String tokenEndPoint = Optional.ofNullable(appRegistration.getParameterValue(TOKEN_ENDPOINT_TAG)).orElse("");
String userInfoEndPoint = Optional.ofNullable(appRegistration.getParameterValue(USERINFO_ENDPOINT_TAG)).orElse("");
String scope = Optional.ofNullable(appRegistration.getParameterValue(PARAMETER_SCOPE)).orElse(defaultScope);
setAuthorizationEndPoint(authorizationEndPoint);
setTokenEndpoint(tokenEndPoint);
setUserInfoEndpoint(userInfoEndPoint);
setScope(scope.split(","));
});
}
}
96 changes: 0 additions & 96 deletions src/main/java/org/spin/template/model/validator/Validator.java

This file was deleted.

75 changes: 0 additions & 75 deletions src/main/java/org/spin/template/setup/Deploy.java

This file was deleted.

28 changes: 0 additions & 28 deletions src/main/java/org/spin/template/util/Changes.java

This file was deleted.

Loading

0 comments on commit 3f90911

Please sign in to comment.