Skip to content

Commit

Permalink
V1.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SawamiWataru authored Jun 8, 2017
1 parent 86acfa1 commit e085b1a
Show file tree
Hide file tree
Showing 105 changed files with 6,902 additions and 12,886 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.5.1
IMPROVEMENTS:
* Make relationship registration possible by role. ([#24](https://github.com/personium/personium-core/issues/24))
* If ads: none, unnecessary logs are output.([#25](https://github.com/personium/personium-core/issues/25))
* WebDAV file encryption.([#27](https://github.com/personium/personium-core/issues/27))

## 1.5.0
BUG FIXES:
* Unavailability of TLS 1.2.
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<groupId>io.personium</groupId>
<artifactId>personium-core</artifactId>
<packaging>war</packaging>
<version>1.5.0</version>
<version>1.5.1</version>
<name>personium-core Maven Webapp</name>
<url>http://maven.apache.org</url>
<licenses>
Expand Down Expand Up @@ -31,7 +31,7 @@
<dependency>
<groupId>io.personium</groupId>
<artifactId>personium-lib-common</artifactId>
<version>1.4.2</version>
<version>1.4.3</version>
</dependency>
<dependency>
<groupId>io.personium</groupId>
Expand All @@ -46,7 +46,7 @@
<dependency>
<groupId>io.personium</groupId>
<artifactId>personium-client-java</artifactId>
<version>1.4.3</version>
<version>1.4.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
19 changes: 11 additions & 8 deletions src/main/java/io/personium/core/PersoniumCoreException.java
Original file line number Diff line number Diff line change
Expand Up @@ -577,20 +577,23 @@ public static class ReceivedMessage {
* {0}:RelationClassURL
*/
public static final PersoniumCoreException BOX_THAT_MATCHES_RELATION_CLASS_URL_NOT_EXISTS = create("PR400-RM-0003"); // CHECKSTYLE IGNORE - To maintain readability
/**
* メッセージのRequestRelationのパースに失敗.
*/
public static final PersoniumCoreException REQUEST_RELATION_PARSE_ERROR = create("PR409-RM-0001");

// unnecessary.
// /**
// * メッセージのRequestRelationのパースに失敗.
// */
// public static final PersoniumCoreException REQUEST_RELATION_PARSE_ERROR = create("PR409-RM-0001");

/**
* 関係削除対象のRelationが存在しない.
*/
public static final PersoniumCoreException REQUEST_RELATION_DOES_NOT_EXISTS = create("PR409-RM-0002");

/**
* メッセージのRequestRelationTargetのパースに失敗.
*/
public static final PersoniumCoreException REQUEST_RELATION_TARGET_PARSE_ERROR = create("PR409-RM-0003");
// unnecessary.
// /**
// * メッセージのRequestRelationTargetのパースに失敗.
// */
// public static final PersoniumCoreException REQUEST_RELATION_TARGET_PARSE_ERROR = create("PR409-RM-0003");

/**
* 関係削除対象のExtCellが存在しない.
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/io/personium/core/PersoniumUnitConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ public static final class Security {
* トークンを暗号化する際に利用している秘密鍵.
*/
public static final String AUTH_PASSWORD_SALT = KEY_ROOT + "security.auth.password.salt";

/**
* Encrypt the DAV file (true: enabled false: disabled (default)).
*/
public static final String DAV_ENCRYPT_ENABLED = KEY_ROOT + "security.dav.encrypt.enabled";
}

/**
Expand Down Expand Up @@ -1507,6 +1512,14 @@ public static String getAuthPasswordSalt() {
return get(Security.AUTH_PASSWORD_SALT);
}

/**
* Encrypt the DAV file.
* @return true: enabled false: disabled
*/
public static boolean isDavEncryptEnabled() {
return Boolean.parseBoolean(get(Security.DAV_ENCRYPT_ENABLED));
}

/**
* Repair処理が最初に起動するまでの遅延時間.
* @return Repair処理が最初に起動するまでの遅延時間.
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/personium/core/model/DavCmp.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ public interface DavCmp {
*/
String getContentType();

/**
* @return Encryption type
*/
String getEncryptionType();

/**
* @return true if Cell Level
*/
Expand Down
21 changes: 16 additions & 5 deletions src/main/java/io/personium/core/model/ctl/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public class Common {
private Common() {
}

/** Regular expression in generic name. */
private static final String REGEX_NAME = "[a-zA-Z0-9][a-zA-Z0-9-_]{0,127}";
/** Regular expression in relation name. */
private static final String REGEX_RELATION_NAME = "[a-zA-Z0-9-\\+][a-zA-Z0-9-_\\+:]{0,127}";

/**
* UnitCtlの名前空間名.
*/
Expand Down Expand Up @@ -78,26 +83,32 @@ private Common() {
/** 拡張スキーマFormat定義.1つ以上のスペース区切り英数字. */
public static final String P_FORMAT_PATTERN_USUSST = "unordered-set-of-unique-space-separated-tokens";
/** 先頭が-,_以外で始まる半角英数大小文字,-,_が1文字から128文字. */
public static final String PATTERN_NAME = "^[a-zA-Z0-9][a-zA-Z0-9-_]{0,127}$";
public static final String PATTERN_NAME = "^" + REGEX_NAME + "$";
/** 先頭が半角記号以外で始まる半角英数大小文字,半角記号(-_!#$%*+/=^`{|}~.@)が1文字から128文字. */
public static final String PATTERN_NAME_WITH_SIGN = "^[a-zA-Z0-9][a-zA-Z0-9-_!$*=^`{|}~.@]{0,127}$";
/** 先頭が_,:以外で始まる半角英数大小文字,-,_,+,:が1文字から128文字. */
public static final String PATTERN_RELATION_NAME = "^[a-zA-Z0-9-\\+][a-zA-Z0-9-_\\+:]{0,127}$";
public static final String PATTERN_RELATION_NAME = "^" + REGEX_RELATION_NAME + "$";
/** String containing "/__relation/__/".<br>
* Explanation of applicable group.<br>
* $1:BaseURL
* $2:CellName
* $3:RelationName */
public static final String PATTERN_RELATION_CLASS_URL = "(^.+)/([^/]+)/__relation/__/([^/]+)/?";
public static final String PATTERN_RELATION_CLASS_URL = "(^.+)/([^/]+)/__relation/__/(" + REGEX_RELATION_NAME + ")/?$"; // CHECKSTYLE IGNORE - To maintain readability
/** String containing "/__role/__/".<br>
* Explanation of applicable group.<br>
* $1:BaseURL
* $2:CellName
* $3:RoleName */
public static final String PATTERN_ROLE_CLASS_URL = "(^.+)/([^/]+)/__role/__/(" + REGEX_NAME + ")/?$";
/** multiplicityのFormat定義. */
public static final String PATTERN_MULTIPLICITY = "0\\.\\.1|1|\\*";
/** 先頭が-,_以外で始まる半角英数大小文字,-,_が1文字から200文字. */
public static final String PATTERN_ID = "^[a-zA-Z0-9][a-zA-Z0-9-_:]{0,199}$";
/** InReplyTo32文字. */
public static final String PATTERN_IN_REPLY_TO = "^.{32}$";
/** メッセージタイプ_messageまたはreq.relation.buildまたはreq.relation.break. */
/** MessageType message or req.relation.build or req.relation.break or req.role.grant or req.role.revoke. */
public static final String PATTERN_MESSAGE_TYPE =
"^(message)|(req\\.relation\\.build)|(req\\.relation\\.break)$";
"^(message)|(req\\.relation\\.build)|(req\\.relation\\.break)|(req\\.role\\.grant)|(req\\.role\\.revoke)$";
/** メッセージタイトル0文字から256文字文字. */
public static final String PATTERN_MESSAGE_TITLE = "^.{0,256}$";
/** メッセージプライオリティ 1から5. */
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/io/personium/core/model/ctl/ReceivedMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,16 @@ protected ReceivedMessage() {
*/
public static final String EDM_NPNAME_FOR_ACCOUNT = "_AccountRead";

/** タイプ メッセージ. */
/** Type message. */
public static final String TYPE_MESSAGE = "message";
/** タイプ 関係登録. */
/** Type register relation. */
public static final String TYPE_REQ_RELATION_BUILD = "req.relation.build";
/** タイプ 関係削除. */
/** Type delete relation. */
public static final String TYPE_REQ_RELATION_BREAK = "req.relation.break";
/** Type register relation role. */
public static final String TYPE_REQ_ROLE_GRANT = "req.role.grant";
/** Type delete relation role. */
public static final String TYPE_REQ_ROLE_REVOKE = "req.role.revoke";

/** ステータス 未読. */
public static final String STATUS_UNREAD = "unread";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ public class StreamingOutputForDavFile implements StreamingOutput {
InputStream hardLinkInput = null;

/**
* コンストラクタ.
* @param fileFullPath 読み込むファイルのフルパス
* @throws BinaryDataNotFoundException ファイルが存在しない場合.
* Constructor.
* @param fileFullPath Full path of the file to be read
* @param cellId Cell ID
* @param encryptionType encryption type
* @throws BinaryDataNotFoundException Error when file does not exist.
*/
public StreamingOutputForDavFile(String fileFullPath) throws BinaryDataNotFoundException {
public StreamingOutputForDavFile(String fileFullPath, String cellId, String encryptionType)
throws BinaryDataNotFoundException {
if (!Files.exists(Paths.get(fileFullPath))) {
throw new BinaryDataNotFoundException(fileFullPath);
}
Expand All @@ -81,7 +84,15 @@ public StreamingOutputForDavFile(String fileFullPath) throws BinaryDataNotFoundE
hardLinkPath = Files.createLink(Paths.get(hardLinkName), Paths.get(fileFullPath));
}
// ハードリンクからの入力ストリームを取得
hardLinkInput = new BufferedInputStream(new FileInputStream(hardLinkPath.toFile()));
InputStream inputStream;
if (DataCryptor.ENCRYPTION_TYPE_AES.equals(encryptionType)) {
// Perform decryption.
DataCryptor cryptor = new DataCryptor(cellId);
inputStream = cryptor.decode(new FileInputStream(hardLinkPath.toFile()));
} else {
inputStream = new FileInputStream(hardLinkPath.toFile());
}
hardLinkInput = new BufferedInputStream(inputStream);
// 成功したら終了
return;
} catch (IOException e) {
Expand All @@ -98,6 +109,9 @@ public StreamingOutputForDavFile(String fileFullPath) throws BinaryDataNotFoundE
throw new BinaryDataNotFoundException("Unable to create hard link for DAV file: " + hardLinkName);
}

/**
* {@inheritDoc}
*/
@Override
public void write(OutputStream output) throws IOException, WebApplicationException {
if (null == hardLinkInput) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ public class StreamingOutputForDavFileWithRange extends StreamingOutputForDavFil
* @param fileFullPath 読み込むファイルのフルパス
* @param fileSize 読み込むファイルのサイズ
* @param range RangeHeader
* @param cellId Cell ID
* @param encryptionType encryption type
* @throws BinaryDataNotFoundException ファイルが存在しない場合.
*/
public StreamingOutputForDavFileWithRange(final String fileFullPath,
final long fileSize,
final RangeHeaderHandler range) throws BinaryDataNotFoundException {
super(fileFullPath);
final RangeHeaderHandler range,
String cellId,
String encryptionType) throws BinaryDataNotFoundException {
super(fileFullPath, cellId, encryptionType);
this.range = range;
this.fileSize = fileSize;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import io.personium.core.model.impl.es.doc.CellDocHandler;
import io.personium.core.model.impl.es.doc.OEntityDocHandler;
import io.personium.core.model.impl.es.odata.CellCtlODataProducer;
import io.personium.core.model.impl.fs.DavCmpFsImpl;
import io.personium.core.model.lock.CellLockManager;
import io.personium.core.odata.OEntityWrapper;
import io.personium.core.utils.UriUtils;
Expand Down Expand Up @@ -699,7 +700,7 @@ private void addRole(String uuid, List<Role> roles) {
String boxName = null;
if (boxId != null) {
// Boxの検索
Map<String, Object> boxsrc = DavCmpEsImpl.searchBox(this, boxId);
Map<String, Object> boxsrc = DavCmpFsImpl.searchBox(this, boxId);
Map<String, Object> boxs = (Map<String, Object>) boxsrc.get("s");
boxName = (String) boxs.get(KEY_NAME);
}
Expand Down
Loading

0 comments on commit e085b1a

Please sign in to comment.