Skip to content

Commit

Permalink
working on making a structure that makes sense
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn-mcginty committed Jun 22, 2020
1 parent 4468035 commit e988c6a
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .idea/dictionaries/shawn.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions .idea/scala_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ repositories {
}

dependencies {
implementation 'de.mkammerer:argon2-jvm:2.7'
implementation 'org.scala-lang:scala-library:2.13.2'
// implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
// implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-core'
// implementation 'org.springframework.session:spring-session-jdbc'
implementation 'org.scalatra.scalate:scalate-core_2.13:1.9.6'
// runtimeOnly 'org.postgresql:postgresql'
runtimeOnly 'org.postgresql:postgresql'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
Expand Down
12 changes: 11 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
server.error.whitelabel.enabled=false
# spring config
server.error.whitelabel.enabled=false

spring.datasource.url=jdbc:postgresql://localhost:5432/bringo_dev
spring.datasource.username=bringo
spring.datasource.password=bringo1

spring.flyway.user=bringo
spring.flyway.password=bringo1
spring.flyway.url=jdbc:postgresql://localhost:5432/bringo_dev
spring.flyway.locations=classpath:db/migration
12 changes: 12 additions & 0 deletions src/main/resources/db/migration/V1_0_0__init_tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS users (
user_id serial PRIMARY KEY,
password VARCHAR (255) NOT NULL,
email VARCHAR (255) UNIQUE NOT NULL,
created_on TIMESTAMP NOT NULL,
last_login TIMESTAMP
);

CREATE INDEX users_email_password ON users (email, password);

INSERT INTO users (password, email, created_on)
VALUES ('$argon2i$v=19$m=65536,t=10,p=1$FgVrvOhkkEHtWRIc6W29gw$0P1W/kPR7/FWR0ti48F5SSHetUfqSaUaueOr92oUDuw', '[email protected]', now());
1 change: 1 addition & 0 deletions src/main/scala/org/bringo/server/Main.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.bringo.server

import org.bringo.server.utils.CryptoUtils
import org.springframework.context.annotation.Configuration
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.ComponentScan
Expand Down
10 changes: 10 additions & 0 deletions src/main/scala/org/bringo/server/utils/CryptoUtils.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.bringo.server.utils

import de.mkammerer.argon2.Argon2Factory

object CryptoUtils {
def hashPasswod (pdub: String) = {
val argon = Argon2Factory.create()
argon.hash(10, 65536, 1, pdub.toCharArray())
}
}

0 comments on commit e988c6a

Please sign in to comment.