mirror of
https://github.com/sismics/docs.git
synced 2025-01-03 16:53:49 +01:00
clean up
This commit is contained in:
parent
db721a9d10
commit
1e57ee5fb3
@ -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>.
|
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
|
docker run --rm --name sismics_docs_latest -d -p 8100:8080 -v sismics_docs_latest:/data sismics/docs:latest
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.sismics.docs.core.util;
|
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.analysis.standard.StandardAnalyzer;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
@ -10,7 +9,7 @@ import org.apache.lucene.store.Directory;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.sismics.docs.core.model.context.AppContext;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lucene utils.
|
* Lucene utils.
|
||||||
@ -26,8 +25,7 @@ public class LuceneUtil {
|
|||||||
/**
|
/**
|
||||||
* Encapsulate a process into a Lucene context.
|
* Encapsulate a process into a Lucene context.
|
||||||
*
|
*
|
||||||
* @param runnable
|
* @param runnable Runnable
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
public static void handle(LuceneRunnable runnable) {
|
public static void handle(LuceneRunnable runnable) {
|
||||||
// Standard analyzer
|
// Standard analyzer
|
||||||
@ -53,14 +51,18 @@ public class LuceneUtil {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error in running index writing transaction", e);
|
log.error("Error in running index writing transaction", e);
|
||||||
try {
|
try {
|
||||||
indexWriter.rollback();
|
if (indexWriter != null) {
|
||||||
|
indexWriter.rollback();
|
||||||
|
}
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
log.error("Cannot rollback index writing transaction", e1);
|
log.error("Cannot rollback index writing transaction", e1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
indexWriter.close();
|
if (indexWriter != null) {
|
||||||
|
indexWriter.close();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Cannot commit and close IndexWriter", e);
|
log.error("Cannot commit and close IndexWriter", e);
|
||||||
}
|
}
|
||||||
@ -75,9 +77,9 @@ public class LuceneUtil {
|
|||||||
/**
|
/**
|
||||||
* Code to run in a Lucene context.
|
* Code to run in a Lucene context.
|
||||||
*
|
*
|
||||||
* @param indexWriter
|
* @param indexWriter Index writer
|
||||||
* @throws Exception
|
* @throws Exception e
|
||||||
*/
|
*/
|
||||||
public abstract void run(IndexWriter indexWriter) throws Exception;
|
void run(IndexWriter indexWriter) throws Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,19 +30,14 @@
|
|||||||
|
|
||||||
package com.sismics.util.totp;
|
package com.sismics.util.totp;
|
||||||
|
|
||||||
import java.security.InvalidKeyException;
|
import org.apache.commons.codec.binary.Base32;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
import org.apache.commons.codec.binary.Base32;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements the functionality described in RFC 6238 (TOTP: Time
|
* 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.
|
* 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.
|
* Magic number representing an invalid scratch code.
|
||||||
@ -171,14 +166,6 @@ public final class GoogleAuthenticator {
|
|||||||
config = new GoogleAuthenticatorConfig();
|
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.
|
* @return the random number generator algorithm.
|
||||||
* @since 0.5.0
|
* @since 0.5.0
|
||||||
@ -227,7 +214,7 @@ public final class GoogleAuthenticator {
|
|||||||
* @return the validation code for the provided key at the specified instant
|
* @return the validation code for the provided key at the specified instant
|
||||||
* of time.
|
* 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
|
// Allocating an array of bytes to represent the specified instant
|
||||||
// of time.
|
// of time.
|
||||||
byte[] data = new byte[8];
|
byte[] data = new byte[8];
|
||||||
@ -439,7 +426,7 @@ public final class GoogleAuthenticator {
|
|||||||
return authorize(secret, verificationCode, new Date().getTime());
|
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.
|
// Checking user input and failing if the secret key was not provided.
|
||||||
if (secret == null) {
|
if (secret == null) {
|
||||||
throw new IllegalArgumentException("Secret cannot be null.");
|
throw new IllegalArgumentException("Secret cannot be null.");
|
||||||
|
3
pom.xml
3
pom.xml
@ -49,6 +49,7 @@
|
|||||||
<org.jsoup.jsoup.version>1.11.2</org.jsoup.jsoup.version>
|
<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>
|
<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-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-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>
|
<org.eclipse.jetty.jetty-servlet.version>9.2.13.v20150730</org.eclipse.jetty.jetty-servlet.version>
|
||||||
@ -199,7 +200,7 @@
|
|||||||
<artifactId>commons-lang</artifactId>
|
<artifactId>commons-lang</artifactId>
|
||||||
<version>${commons-lang.commons-lang.version}</version>
|
<version>${commons-lang.commons-lang.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
|
Loading…
Reference in New Issue
Block a user