This commit is contained in:
Benjamin Gamard 2018-03-14 14:53:41 +01:00
parent db721a9d10
commit 1e57ee5fb3
4 changed files with 23 additions and 33 deletions

View File

@ -57,7 +57,7 @@ Install with Docker
-------------------
From a Docker host, run this command to download and install Sismics Docs. The server will run on <http://[your-docker-host-ip]:8100>.
The default admin password is "admin". Don't forget to change it before going to production.
**The default admin password is "admin". Don't forget to change it before going to production.**
docker run --rm --name sismics_docs_latest -d -p 8100:8080 -v sismics_docs_latest:/data sismics/docs:latest

View File

@ -1,7 +1,6 @@
package com.sismics.docs.core.util;
import java.io.IOException;
import com.sismics.docs.core.model.context.AppContext;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
@ -10,7 +9,7 @@ import org.apache.lucene.store.Directory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sismics.docs.core.model.context.AppContext;
import java.io.IOException;
/**
* Lucene utils.
@ -26,8 +25,7 @@ public class LuceneUtil {
/**
* Encapsulate a process into a Lucene context.
*
* @param runnable
* @throws IOException
* @param runnable Runnable
*/
public static void handle(LuceneRunnable runnable) {
// Standard analyzer
@ -53,14 +51,18 @@ public class LuceneUtil {
} catch (Exception e) {
log.error("Error in running index writing transaction", e);
try {
indexWriter.rollback();
if (indexWriter != null) {
indexWriter.rollback();
}
} catch (IOException e1) {
log.error("Cannot rollback index writing transaction", e1);
}
}
try {
indexWriter.close();
if (indexWriter != null) {
indexWriter.close();
}
} catch (IOException e) {
log.error("Cannot commit and close IndexWriter", e);
}
@ -75,9 +77,9 @@ public class LuceneUtil {
/**
* Code to run in a Lucene context.
*
* @param indexWriter
* @throws Exception
* @param indexWriter Index writer
* @throws Exception e
*/
public abstract void run(IndexWriter indexWriter) throws Exception;
void run(IndexWriter indexWriter) throws Exception;
}
}

View File

@ -30,19 +30,14 @@
package com.sismics.util.totp;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Random;
import org.apache.commons.codec.binary.Base32;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base32;
import org.apache.commons.codec.binary.Base64;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.*;
/**
* This class implements the functionality described in RFC 6238 (TOTP: Time
@ -116,7 +111,7 @@ public final class GoogleAuthenticator {
/**
* Modulus used to truncate the scratch code.
*/
public static final int SCRATCH_CODE_MODULUS = (int) Math.pow(10, SCRATCH_CODE_LENGTH);
private static final int SCRATCH_CODE_MODULUS = (int) Math.pow(10, SCRATCH_CODE_LENGTH);
/**
* Magic number representing an invalid scratch code.
@ -171,14 +166,6 @@ public final class GoogleAuthenticator {
config = new GoogleAuthenticatorConfig();
}
public GoogleAuthenticator(GoogleAuthenticatorConfig config) {
if (config == null) {
throw new IllegalArgumentException("Configuration cannot be null.");
}
this.config = config;
}
/**
* @return the random number generator algorithm.
* @since 0.5.0
@ -227,7 +214,7 @@ public final class GoogleAuthenticator {
* @return the validation code for the provided key at the specified instant
* of time.
*/
int calculateCode(byte[] key, long tm) {
private int calculateCode(byte[] key, long tm) {
// Allocating an array of bytes to represent the specified instant
// of time.
byte[] data = new byte[8];
@ -439,7 +426,7 @@ public final class GoogleAuthenticator {
return authorize(secret, verificationCode, new Date().getTime());
}
public boolean authorize(String secret, int verificationCode, long time) throws GoogleAuthenticatorException {
private boolean authorize(String secret, int verificationCode, long time) throws GoogleAuthenticatorException {
// Checking user input and failing if the secret key was not provided.
if (secret == null) {
throw new IllegalArgumentException("Secret cannot be null.");

View File

@ -49,6 +49,7 @@
<org.jsoup.jsoup.version>1.11.2</org.jsoup.jsoup.version>
<com.github.jai-imageio.jai-imageio-jpeg2000.version>1.3.0</com.github.jai-imageio.jai-imageio-jpeg2000.version>
<!-- Migrate to Java 8 before upgrading this -->
<org.eclipse.jetty.jetty-server.version>9.2.13.v20150730</org.eclipse.jetty.jetty-server.version>
<org.eclipse.jetty.jetty-webapp.version>9.2.13.v20150730</org.eclipse.jetty.jetty-webapp.version>
<org.eclipse.jetty.jetty-servlet.version>9.2.13.v20150730</org.eclipse.jetty.jetty-servlet.version>
@ -199,7 +200,7 @@
<artifactId>commons-lang</artifactId>
<version>${commons-lang.commons-lang.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>