Skip to content

Commit d5165f2

Browse files
authored
Merge pull request #40 from Hub-of-all-Things/dev
v2.5.1
2 parents ede021a + 78ae20b commit d5165f2

File tree

92 files changed

+1627
-4608
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1627
-4608
lines changed

.travis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
language: scala
22
dist: trusty
3-
sudo: required
3+
sudo: false
44
scala:
55
- 2.12.4
66
jdk:
7-
- oraclejdk8
7+
- openjdk8
88

99
services:
1010
- docker
@@ -92,7 +92,7 @@ script:
9292
- |
9393
if [[ "$REPOSITORY_NAME" = "hubat" ]]; then
9494
sbt ++$TRAVIS_SCALA_VERSION test:compile
95-
sbt "project hat" coverage "testOnly org.hatdex.hat.*" -Dconfig.file=hat/conf/application.test.conf
95+
sbt ++$TRAVIS_SCALA_VERSION "project hat" coverage test -Dconfig.file=hat/conf/application.test.conf
9696
fi
9797
- sbt -Denv=prod docker:stage
9898
- docker build -t ${REPOSITORY_NAME}/hat:$(git rev-parse --short HEAD) hat/target/docker/stage
@@ -102,7 +102,7 @@ after_success:
102102
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm
103103
- |
104104
if [[ "$TRAVIS_PULL_REQUEST" = "false" || -z "$RUMPEL" ]]; then
105-
sbt coverageReport && sbt coverageAggregate && sbt coveralls
105+
sbt coverageReport && sbt coveralls
106106
fi
107107
108108
before_deploy:

README.md

+15-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This repository contains an implementation of the [Hub-of-All-Things](http://hub
77

88
## Releases
99

10-
The current project version is 2.4.1 [HAT 2.4.1](https://github.com/Hub-of-all-Things/HAT2.0/releases/tag/v2.4.1).
10+
The current project version is 2.5.1: [HAT 2.5.1](https://github.com/Hub-of-all-Things/HAT2.0/releases/tag/v2.5.1).
1111

1212
## About the project
1313

@@ -22,9 +22,9 @@ A Personal Data Management System (“the HAT”) is a personal single tenant (
2222
This HAT PDS implementation is written in Scala (2.11.8) uses the following technology stack:
2323

2424
- PostgreSQL relational database (version 9.5)
25-
- Play Framework (version 2.5.4)
26-
- Akka (version 2.4.7)
27-
- Slick as the database access layer (version 3.1.1)
25+
- Play Framework (version 2.6.6)
26+
- Akka (version 2.5.4)
27+
- Slick as the database access layer (version 3.2.1)
2828

2929
## Running the project
3030

@@ -59,7 +59,7 @@ To launch the HAT, follow these steps:
5959
```
6060
4. Run the project:
6161
```bash
62-
sbt "project hat" -Dconfig.resource=dev.conf run
62+
sbt "project hat" "run -Dconfig.resource=dev.conf"
6363
```
6464
5. Go to http://bobtheplumber.hat.org:9000
6565

@@ -68,9 +68,16 @@ To launch the HAT, follow these steps:
6868
### Customising development environment
6969
7070
Your best source of information on how the development environment could
71-
be customised is the `hat/conf/dev.conf` configuration file. Make sure it
72-
is *enabled* in `hat/conf/activeHats.conf` -- such setup is not intended
73-
to be used in production, but becomes handy for local testing.
71+
be customised is the `hat/conf/dev.conf` configuration file. Make sure you
72+
run the project locally with the configuration enabled (using the steps above)
73+
or it will just show you the message that the HAT could not be found.
74+
75+
Among other things, the configuration includes:
76+
77+
- host names alongside port numbers of the test HATs (bobtheplumber.hat.org:9000)
78+
- access credentials used to log in as the owner or restricted platform user into the HAT (the default password is a very unsafe *testing*)
79+
- database connection details (important if you want to change your database setup above)
80+
- private and public keys used for token signing and verification
7481
7582
Specifically, it has 4 major sections:
7683

build.sbt

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ lazy val hat = project
3838
),
3939
libraryDependencies := (buildEnv.value match {
4040
case BuildEnv.Developement | BuildEnv.Test =>
41-
println("Adding specs2!")
4241
libraryDependencies.value ++ Seq(
4342
Library.Play.specs2,
4443
Library.Specs2.core,

hat/app/org/hatdex/hat/api/controllers/Authentication.scala

+5-4
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,13 @@ class Authentication @Inject() (
112112

113113
def accessToken(): Action[AnyContent] = (UserAwareAction andThen limiter.UserAwareRateLimit).async { implicit request =>
114114
val eventuallyAuthenticatedUser = for {
115-
usernameParam <- request.getQueryString("username").orElse(request.headers.get("username"))
116-
passwordParam <- request.getQueryString("password").orElse(request.headers.get("password"))
115+
usernameParam <- request.headers.get("username")
116+
passwordParam <- request.headers.get("password")
117117
} yield {
118118
val username = URLDecoder.decode(usernameParam, "UTF-8")
119119
val password = URLDecoder.decode(passwordParam, "UTF-8")
120120
credentialsProvider.authenticate(Credentials(username, password))
121+
.map(_.copy(request.dynamicEnvironment.id))
121122
.flatMap { loginInfo =>
122123
usersService.getUser(loginInfo.providerKey).flatMap {
123124
case Some(user) =>
@@ -141,7 +142,7 @@ class Authentication @Inject() (
141142
}
142143

143144
def passwordChangeProcess: Action[ApiPasswordChange] = SecuredAction(WithRole(Owner())).async(parsers.json[ApiPasswordChange]) { implicit request =>
144-
logger.warn("Processing password change request")
145+
logger.debug("Processing password change request")
145146
request.body.password map { oldPassword =>
146147
val eventualResult = for {
147148
_ <- credentialsProvider.authenticate(Credentials(request.identity.email, oldPassword))
@@ -166,7 +167,7 @@ class Authentication @Inject() (
166167
* Sends an email to the user with a link to reset the password
167168
*/
168169
def handleForgotPassword: Action[ApiPasswordResetRequest] = UserAwareAction.async(parsers.json[ApiPasswordResetRequest]) { implicit request =>
169-
logger.warn("Processing forgotten password request")
170+
logger.debug("Processing forgotten password request")
170171
val email = request.body.email
171172
val response = Ok(Json.toJson(SuccessResponse("If the email you have entered is correct, you will shortly receive an email with password reset instructions")))
172173
if (email == request.dynamicEnvironment.ownerEmail) {

0 commit comments

Comments
 (0)