Skip to content

Commit

Permalink
Merge pull request #23 from personium/1.4.7-dev
Browse files Browse the repository at this point in the history
1.4.7 dev
  • Loading branch information
SawamiWataru authored Apr 19, 2017
2 parents 047156d + 9ccfcfc commit 86acfa1
Show file tree
Hide file tree
Showing 64 changed files with 4,814 additions and 743 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 1.5.0
BUG FIXES:
* Unavailability of TLS 1.2.
([#3](https://github.com/personium/personium-client-java/issues/3))

IMPROVEMENTS:
* Enable specification of class URL in RequestRelation of message API.
([#19](https://github.com/personium/personium-core/issues/19))
* Change OAuth2Token authentication API endpoint.
([#20](https://github.com/personium/personium-core/issues/20))

## 1.4.6
BUG FIXES:
* Implementation of BoxBound function of message API.
Expand Down
4 changes: 2 additions & 2 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.4.6</version>
<version>1.5.0</version>
<name>personium-core Maven Webapp</name>
<url>http://maven.apache.org</url>
<licenses>
Expand Down Expand Up @@ -46,7 +46,7 @@
<dependency>
<groupId>io.personium</groupId>
<artifactId>personium-client-java</artifactId>
<version>1.4.2</version>
<version>1.4.3</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/io/personium/core/PersoniumCoreAuthnException.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@
*/
package io.personium.core;

import io.personium.core.auth.OAuth2Helper.Error;
import io.personium.core.auth.OAuth2Helper.Key;
import io.personium.core.auth.OAuth2Helper.Scheme;
import io.personium.core.utils.EscapeControlCode;
import io.personium.plugin.base.PluginException;
import io.personium.plugin.base.PluginMessageUtils.Severity;

import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -35,6 +28,13 @@
import org.apache.http.HttpStatus;
import org.json.simple.JSONObject;

import io.personium.core.auth.OAuth2Helper.Error;
import io.personium.core.auth.OAuth2Helper.Key;
import io.personium.core.auth.OAuth2Helper.Scheme;
import io.personium.core.utils.EscapeControlCode;
import io.personium.plugin.base.PluginException;
import io.personium.plugin.base.PluginMessageUtils.Severity;

/**
* ログメッセージ作成クラス.
*/
Expand Down Expand Up @@ -234,7 +234,7 @@ public Response createResponse() {
.entity(errorJson.toJSONString());

// レルム値が設定されていれば、WWW-Authenticateヘッダーを返却する。
// __authエンドポイントでは、認証失敗時(401返却時)には、同ヘッダーに Auth SchemeがBasicの値を返却するため、ここでは固定値とする。
// __tokenエンドポイントでは、認証失敗時(401返却時)には、同ヘッダーに Auth SchemeがBasicの値を返却するため、ここでは固定値とする。
if (this.realm != null && statusCode == HttpStatus.SC_UNAUTHORIZED) {
rb = rb.header(HttpHeaders.WWW_AUTHENTICATE, Scheme.BASIC + " realm=\"" + this.realm + "\"");
}
Expand Down
25 changes: 20 additions & 5 deletions src/main/java/io/personium/core/PersoniumCoreException.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
*/
package io.personium.core;

import io.personium.core.exceptions.ODataErrorMessage;
import io.personium.core.utils.EscapeControlCode;
import io.personium.plugin.base.PluginMessageUtils.Severity;

import java.text.MessageFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -29,6 +25,10 @@

import org.apache.http.HttpStatus;

import io.personium.core.exceptions.ODataErrorMessage;
import io.personium.core.utils.EscapeControlCode;
import io.personium.plugin.base.PluginMessageUtils.Severity;

/**
* ログメッセージ作成クラス.
*/
Expand Down Expand Up @@ -543,6 +543,11 @@ public static class SentMessage {
* 送信先URLが最大送信許可数を超えた場合.
*/
public static final PersoniumCoreException OVER_MAX_SENT_NUM = create("PR400-SM-0003");
/**
* When the Box corresponding to the schema can not be found from the schema-authenticated token.
* {0}:Schema
*/
public static final PersoniumCoreException BOX_THAT_MATCHES_SCHEMA_NOT_EXISTS = create("PR400-SM-0004");

/**
* リクエストに失敗した場合.
Expand All @@ -557,11 +562,21 @@ public static class SentMessage {
/**
* ReceiveMessageAPI呼出し時のエラー.
*/
public static class ReceiveMessage {
public static class ReceivedMessage {
/**
* メッセージの関係登録で既に関係が存在する.
*/
public static final PersoniumCoreException REQUEST_RELATION_EXISTS_ERROR = create("PR400-RM-0001");
/**
* When a Box corresponding to the schema can not be found.
* {0}:Schema
*/
public static final PersoniumCoreException BOX_THAT_MATCHES_SCHEMA_NOT_EXISTS = create("PR400-RM-0002");
/**
* When the Box corresponding to the RelationClassURL can not be found.
* {0}:RelationClassURL
*/
public static final PersoniumCoreException BOX_THAT_MATCHES_RELATION_CLASS_URL_NOT_EXISTS = create("PR400-RM-0003"); // CHECKSTYLE IGNORE - To maintain readability
/**
* メッセージのRequestRelationのパースに失敗.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ private static boolean isBatchPath(List<PathSegment> pathSegment) {
}

private static boolean isAuthPath(List<PathSegment> pathSegment) {
// 認証のパスは/cell名/__auth または /cell名/__authz のためサイズを2とする
// 認証のパスは/cell名/__token または /cell名/__authz のためサイズを2とする
if (pathSegment.size() == 2) {
String lastPath = pathSegment.get(1).getPath();
if ("__auth".equals(lastPath) || "__authz".equals(lastPath)) {
if ("__token".equals(lastPath) || "__authz".equals(lastPath)) {
return true;
}
}
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/io/personium/core/model/ctl/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ private Common() {
public static final String P_FORMAT_PATTERN_SCHEMA_URI = "schema-uri";
/** 拡張スキーマFormat定義. */
public static final String P_FORMAT_PATTERN_CELL_URL = "cell-url";
/** Extended schema Format definition(Message RequestRelation). */
public static final String P_FORMAT_PATTERN_MESSAGE_REQUEST_RELATION = "message-request-relation";
/** 拡張スキーマFormat定義.1つ以上のスペース区切り英数字. */
public static final String P_FORMAT_PATTERN_USUSST = "unordered-set-of-unique-space-separated-tokens";
/** 先頭が-,_以外で始まる半角英数大小文字,-,_が1文字から128文字. */
Expand All @@ -81,6 +83,12 @@ private Common() {
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}$";
/** String containing "/__relation/__/".<br>
* Explanation of applicable group.<br>
* $1:BaseURL
* $2:CellName
* $3:RelationName */
public static final String PATTERN_RELATION_CLASS_URL = "(^.+)/([^/]+)/__relation/__/([^/]+)/?";
/** multiplicityのFormat定義. */
public static final String PATTERN_MULTIPLICITY = "0\\.\\.1|1|\\*";
/** 先頭が-,_以外で始まる半角英数大小文字,-,_が1文字から200文字. */
Expand Down Expand Up @@ -158,6 +166,10 @@ private Common() {
* MessagePriority項目に対するp:Formatの定義.
*/
public static final List<EdmAnnotation<?>> P_FORMAT_MESSAGE_PRIORITY = new ArrayList<EdmAnnotation<?>>();
/**
* Definition of p: Format for MessageRequestRelation item.
*/
public static final List<EdmAnnotation<?>> P_FORMAT_MESSAGE_REQUEST_RELATION = new ArrayList<EdmAnnotation<?>>();
/**
* AccountType項目に対するp:Formatの定義.
*/
Expand Down Expand Up @@ -193,6 +205,7 @@ private Common() {
P_FORMAT_MESSAGE_TYPE.add(createFormatMessageTypeAnnotation());
P_FORMAT_MESSAGE_TITLE.add(createFormatMessageTitleAnnotation());
P_FORMAT_MESSAGE_PRIORITY.add(createFormatMessagePriorityAnnotation());
P_FORMAT_MESSAGE_REQUEST_RELATION.add(createFormatMessageRequestRelation());
P_FORMAT_ACCOUNT_TYPE.add(createFormatAccountTypeAnnotation());
}

Expand Down Expand Up @@ -316,6 +329,16 @@ public static EdmAnnotation<?> createFormatMessagePriorityAnnotation() {
P_FORMAT, P_FORMAT_PATTERN_REGEX + "('" + Common.PATTERN_MESSAGE_PRIORITY + "')");
}

/**
* Return p: Format Annotation for MessageRequestRelation item.
* @return EdmAnnotation
*/
public static EdmAnnotation<?> createFormatMessageRequestRelation() {
return new EdmAnnotationAttribute(
P_NAMESPACE.getUri(), P_NAMESPACE.getPrefix(),
P_FORMAT, P_FORMAT_PATTERN_MESSAGE_REQUEST_RELATION);
}

/**
* Account Type 項目に対するp:FormatのAnnotationを返却.
* @return EdmAnnotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected ReceivedMessage() {
public static final EdmProperty.Builder P_REQUEST_RELATION = EdmProperty.newBuilder("RequestRelation")
.setType(EdmSimpleType.STRING)
.setNullable(true)
.setAnnotations(Common.P_FORMAT_URI);
.setAnnotations(Common.P_FORMAT_MESSAGE_REQUEST_RELATION);
/**
* RequestRelationTargetプロパティの定義体.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/personium/core/model/ctl/SentMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected SentMessage() {
public static final EdmProperty.Builder P_REQUEST_RELATION = EdmProperty.newBuilder("RequestRelation")
.setType(EdmSimpleType.STRING)
.setNullable(true)
.setAnnotations(Common.P_FORMAT_URI);
.setAnnotations(Common.P_FORMAT_MESSAGE_REQUEST_RELATION);
/**
* RequestRelationTargetプロパティの定義体.
*/
Expand Down
Loading

0 comments on commit 86acfa1

Please sign in to comment.