Repository: incubator-predictionio Updated Branches: refs/heads/develop b7d8815e1 -> bb964740c
[PIO-54] Avoid access key started with - Closes #349 Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/commit/bb964740 Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/tree/bb964740 Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/diff/bb964740 Branch: refs/heads/develop Commit: bb964740cdae30b7bfba4b1a5f290130a205c18f Parents: b7d8815 Author: Shinsuke Sugaya <[email protected]> Authored: Sat Feb 25 22:34:07 2017 -0800 Committer: Donald Szeto <[email protected]> Committed: Sat Feb 25 22:34:07 2017 -0800 ---------------------------------------------------------------------- .../scala/org/apache/predictionio/data/storage/AccessKeys.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/bb964740/data/src/main/scala/org/apache/predictionio/data/storage/AccessKeys.scala ---------------------------------------------------------------------- diff --git a/data/src/main/scala/org/apache/predictionio/data/storage/AccessKeys.scala b/data/src/main/scala/org/apache/predictionio/data/storage/AccessKeys.scala index 71800cb..b96bd82 100644 --- a/data/src/main/scala/org/apache/predictionio/data/storage/AccessKeys.scala +++ b/data/src/main/scala/org/apache/predictionio/data/storage/AccessKeys.scala @@ -69,6 +69,9 @@ trait AccessKeys { val sr = SecureRandom.getInstanceStrong val srBytes = Array.fill(48)(0.toByte) sr.nextBytes(srBytes) - Base64.encodeBase64URLSafeString(srBytes) + Base64.encodeBase64URLSafeString(srBytes) match { + case x if x startsWith "-" => generateKey + case x => x + } } }
