Skip to content

Commit

Permalink
Feature/authentication (#14)
Browse files Browse the repository at this point in the history
* Basic Authentication für den Client implementiert (fixes #13)

* Version 1.1.0

* neueres Gradle BND Plugin verwenden

* Authenifizierung im Betriebshandbuch beschrieben
  • Loading branch information
ChristianHoesel authored Nov 13, 2020
1 parent 1f17041 commit 2fba3e5
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 83 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}
dependencies {
classpath "org.raml.jaxrs:raml-to-jaxrs-gradle-plugin:3.0.5"
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:4.1.0"
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:5.2.0"
classpath "gradle.plugin.de.fntsoftware.gradle:markdown-to-pdf:1.1.0"
}
}
Expand All @@ -25,11 +25,11 @@ allprojects {
mavenLocal()
maven { url "https://dl.bintray.com/bitctrl/maven" }
mavenCentral()
maven { url "http://h2727649.stratoserver.net:8081/repository/nerz-maven-public/" }
maven { url "https://repo.nerz-ev.de" }
}

group = 'de.bitctrl.dav.rest'
version = '1.0.2-SNAPSHOT'
version = '1.1.0-SNAPSHOT'
}

markdownToPdf{
Expand Down
20 changes: 0 additions & 20 deletions de.bitctrl.dav.rest.api/.classpath
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="bin/main" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/main" path="src/main/resources">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/java">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/resources">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/main" path="build/generated">
<attributes>
<attribute name="gradle_scope" value="main"/>
Expand Down
106 changes: 53 additions & 53 deletions de.bitctrl.dav.rest.api/config/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<!--
This configuration file was written by the eclipse-cs plugin configuration editor
-->
-->
<!--
Checkstyle-Configuration: Local
Description: none
-->
<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="MethodTypeParameterName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AnonInnerLength"/>
<module name="ExecutableStatementCount">
<property name="tokens" value="INSTANCE_INIT,STATIC_INIT,METHOD_DEF,CTOR_DEF"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="OuterTypeNumber"/>
<module name="MethodCount"/>
<module name="RedundantModifier"/>
<module name="ModifierOrder"/>
<module name="AvoidInlineConditionals">
<property name="severity" value="info"/>
</module>
<module name="InnerAssignment"/>
<module name="OneStatementPerLine"/>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="VisibilityModifier"/>
<module name="BooleanExpressionComplexity"/>
<module name="ClassDataAbstractionCoupling"/>
<module name="ClassFanOutComplexity"/>
<module name="CyclomaticComplexity"/>
<module name="JavaNCSS"/>
<module name="NPathComplexity"/>
<module name="JavadocType">
<property name="scope" value="package"/>
<property name="authorFormat" value="BitCtrl Systems GmbH, .+"/>
</module>
</module>
<module name="JavadocPackage"/>
<module name="FileLength"/>
<module name="Header">
<property name="headerFile" value="${basedir}/config/java.header"/>
</module>
</module>
-->
<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="MethodTypeParameterName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AnonInnerLength"/>
<module name="ExecutableStatementCount">
<property name="tokens" value="INSTANCE_INIT,STATIC_INIT,METHOD_DEF,CTOR_DEF"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="OuterTypeNumber"/>
<module name="MethodCount"/>
<module name="RedundantModifier"/>
<module name="ModifierOrder"/>
<module name="AvoidInlineConditionals">
<property name="severity" value="info"/>
</module>
<module name="InnerAssignment"/>
<module name="OneStatementPerLine"/>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="VisibilityModifier"/>
<module name="BooleanExpressionComplexity"/>
<module name="ClassDataAbstractionCoupling"/>
<module name="ClassFanOutComplexity"/>
<module name="CyclomaticComplexity"/>
<module name="JavaNCSS"/>
<module name="NPathComplexity"/>
<module name="JavadocType">
<property name="scope" value="package"/>
<property name="authorFormat" value="BitCtrl Systems GmbH, .+"/>
</module>
</module>
<module name="JavadocPackage"/>
<module name="FileLength"/>
<module name="Header">
<property name="headerFile" value="${basedir}/config/java.header"/>
</module>
</module>
2 changes: 2 additions & 0 deletions de.bitctrl.dav.rest.client/Betriebshandbuch.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ Die SWE verwendet die Datenverteiler - Applikationsfunktionen zur Kommunikation
* `-objekt=<pid>` : Die PID des Applikationsobjektes (vom Typ `typ.archiv`)
* `-url=http://localhost` : Die URL des REST Servers, der Standardwert ist `http://localhost`.
* `-port=80` : Der Port des REST Servers, der Standardwert ist `9998`.
* `-authUser=` : Nutzername für die Authentifizierung am REST Server (optional).
* `-authPassword=` : Passwort für die Authentifizierung am REST Server (optional).

#### Unterstützte Datenspezifikationen

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import org.glassfish.jersey.jackson.JacksonFeature;

import de.bsvrz.dav.daf.main.ClientDavInterface;
Expand Down Expand Up @@ -56,12 +57,16 @@ public static void main(final String[] args) {
private String serverUrl;
private String port;
private javax.ws.rs.client.Client client;
private String authUser;
private String authPassword;

@Override
public void parseArguments(ArgumentList argumentList) throws Exception {
archivObjektPid = argumentList.fetchArgument("-objekt=").asString();
serverUrl = argumentList.fetchArgument("-url=http://localhost").asString();
port = argumentList.fetchArgument("-port=9998").asString();
authUser = argumentList.fetchArgument("-authUser=").asString();
authPassword = argumentList.fetchArgument("-authPassword=").asString();

}

Expand All @@ -84,6 +89,9 @@ public void initialize(ClientDavInterface connection) throws Exception {

final ClientConfig config = new ClientConfig();
config.register(JacksonFeature.class);
if (!authPassword.isEmpty()) {
config.register(HttpAuthenticationFeature.basic(authUser, authPassword));
}
config.property(ClientProperties.READ_TIMEOUT, 60000);

// ClientBuilder.newBuilder().sslContext(ctx);
Expand All @@ -98,7 +106,6 @@ public void initialize(ClientDavInterface connection) throws Exception {
@Override
public void connectionClosed(ClientDavInterface connection) {
client.close();

}

}
6 changes: 0 additions & 6 deletions de.bitctrl.dav.rest.server/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/main" path="src/main/resources">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/resources">
<attributes>
<attribute name="gradle_scope" value="test"/>
Expand Down

0 comments on commit 2fba3e5

Please sign in to comment.