Browse Source

extended Readme.md

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
sqlite
Stephan Richter 3 months ago
parent
commit
bb45910cb3
  1. 17
      Readme.md
  2. 36
      de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java

17
Readme.md

@ -15,10 +15,12 @@ Im Moment baut das Projekt nur auf die folgenden Laufzeit-Bibliotheken auf: @@ -15,10 +15,12 @@ Im Moment baut das Projekt nur auf die folgenden Laufzeit-Bibliotheken auf:
* [org.json:json](https://github.com/douglascrockford/JSON-java)
* [org.bitbucket.b_c:jose4j](https://bitbucket.org/b_c/jose4j)
* [com.sun.mail:jakarta.mail](https://projects.eclipse.org/projects/ee4j.mail)
* [com.sun.activation:jakarta.activation](https://projects.eclipse.org/projects/ee4j.jaf)
* [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc)
Im Moment haben diese Bibliotheken keine weiteren (transitiven) Anhängigkeiten, so dass das Projekt nicht durch eine Kaskade von Libraries aufgeblasen wird.
Das Ermöglicht es, dass die compilierte JAR-Datei weniger als 1,5 MB groß ist!
Im Gegensatz zum [Main-Branch][main], der keine DB-Abhängigkeiten enthält,
bietet dieser Branch Support für einen SQLite-Datenspeicher.
Leider werden durch die SQLite-Bibliothek weitere Transitive Abhängigkeiten eingebunden,
die das JAR ein wenig aufblähen.
## bauen
@ -34,10 +36,12 @@ Currently, this project only depends on the following runtime libraries: @@ -34,10 +36,12 @@ Currently, this project only depends on the following runtime libraries:
* [org.json:json](https://github.com/douglascrockford/JSON-java)
* [org.bitbucket.b_c:jose4j](https://bitbucket.org/b_c/jose4j)
* [com.sun.mail:jakarta.mail](https://projects.eclipse.org/projects/ee4j.mail)
* [com.sun.activation:jakarta.activation](https://projects.eclipse.org/projects/ee4j.jaf)
* [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc)
At the time of writing, these libraries have no further transitive dependencies, thus mitigating any bloat from the project.
As a result, the compiled jar has a size of less than 1.5 MB!
While the [main] branch does not contain any dependencies for database support,
this branch _does_ allow storing data in an SQLite database.
Unfortunately the SQLite library also draws in some additional dependencies,
which – to a certain extend – increases the size of the compiled JAR archive.
## build
@ -48,4 +52,5 @@ Build the project by launching `./gradlew build` in a terminal while being in th @@ -48,4 +52,5 @@ Build the project by launching `./gradlew build` in a terminal while being in th
</tr>
</table>
[main]: ../main
[specification]: https://openid.net/specs/openid-connect-core-1_0.html

36
de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java

@ -47,11 +47,11 @@ public class Application { @@ -47,11 +47,11 @@ public class Application {
public static final String ROOT = "/";
public static final String STATIC_PATH = "/web";
private static final String BASE_PATH = "basePath";
private static final String FAVICON = "/favicon.ico";
private static final String INDEX = STATIC_PATH + "/index.html";
private static final String WELL_KNOWN = "/.well-known";
private static System.Logger LOG = new ColorLogger("Application").setLogLevel(DEBUG);
private static final String BASE_PATH = "basePath";
private static final String FAVICON = "/favicon.ico";
private static final String INDEX = STATIC_PATH + "/index.html";
private static final String WELL_KNOWN = "/.well-known";
private static System.Logger LOG = new ColorLogger("Application").setLogLevel(DEBUG);
private static ConnectionProvider connectionProvider = new ConnectionProvider();
public static void main(String[] args) throws Exception {
@ -89,7 +89,7 @@ public class Application { @@ -89,7 +89,7 @@ public class Application {
}
private static ClientService setupClientService(Configuration config, Path defaultFile, FileStoreProvider fileStoreProvider) throws SQLException {
var clientStore = new File(config.getOrDefault("client_store", defaultFile));
var clientStore = new File(config.getOrDefault("client_store", defaultFile));
var clientService = switch (extension(clientStore)) {
case "db", "sqlite", "sqlite3" -> new SqliteClientService(connectionProvider.get(clientStore));
default -> fileStoreProvider.get(clientStore);
@ -183,18 +183,18 @@ public class Application { @@ -183,18 +183,18 @@ public class Application {
var token = tokens.remove(0);
switch (token) {
case "--base":
if (tokens.isEmpty()) throw new IllegalArgumentException("--base option requires second argument!");
map.put(BASE_PATH, Path.of(tokens.remove(0)));
break;
case "--config":
if (tokens.isEmpty()) throw new IllegalArgumentException("--config option requires second argument!");
map.put(CONFIG_PATH, Path.of(tokens.remove(0)));
break;
default:
LOG.log(ERROR, "Unknown option: {0}", token);
}
if (tokens.isEmpty()) throw new IllegalArgumentException("--base option requires second argument!");
map.put(BASE_PATH, Path.of(tokens.remove(0)));
break;
case "--config":
if (tokens.isEmpty()) throw new IllegalArgumentException("--config option requires second argument!");
map.put(CONFIG_PATH, Path.of(tokens.remove(0)));
break;
default:
LOG.log(ERROR, "Unknown option: {0}", token);
}
return map;
}
return map;
}
}

Loading…
Cancel
Save