Skip to content

Commit bb6c238

Browse files
authored
Merge pull request #64 from YoungMaker/Sprint
Access control version into master
2 parents 4c70121 + f4f4959 commit bb6c238

Some content is hidden

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

47 files changed

+2238
-508
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/build/
33
!gradle/wrapper/gradle-wrapper.jar
44

5-
/src/main/resources/application.yml
6-
/src/main/resources/application.properties
5+
src/main/resources/application.yml
6+
src/main/resources/application.properties
77
application.yml
88
application.properties
99

build.gradle

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ compileTestKotlin {
3838
jar {
3939
baseName = "api-iorc"
4040
group = "edu.ycp.cs482.iorcapi"
41-
version = "0.0.1-dev"
41+
version = "0.1.0-dep"
4242
manifest { attributes "Main-Class": "edu.ycp.cs482.IorcApiApplication" }
4343
}
4444

@@ -80,9 +80,8 @@ dependencies {
8080
compile "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
8181
//this needs to be here for some reason otherwise bean registration fails
8282
compile("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.2")
83-
83+
compile('commons-validator:commons-validator:1.6')
8484
compile('com.graphql-java:graphql-spring-boot-starter:4.0.0')
85-
8685
compile('com.graphql-java:graphiql-spring-boot-starter:4.0.0')
8786
compile('com.graphql-java:graphql-java-tools:4.3.0')
8887
compile('org.springframework.cloud:spring-cloud-starter-oauth2')
@@ -91,14 +90,12 @@ dependencies {
9190
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
9291
compile('org.springframework.boot:spring-boot-starter-data-rest')
9392
compile('org.springframework.retry:spring-retry')
94-
//compile('org.springframework.boot:spring-boot-starter-security')
9593
compile('org.springframework.boot:spring-boot-starter-web')
9694
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
9795
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
98-
testCompile('org.springframework.boot:spring-boot-starter-test')
99-
//testCompile('org.springframework.security:spring-security-test')
100-
96+
compile('io.jsonwebtoken:jjwt:0.9.0')
10197
compile('com.mmnaseri.utils:spring-data-mock:1.1.4')
98+
testCompile('org.springframework.boot:spring-boot-starter-test')
10299

103100
}
104101

src/main/kotlin/edu/ycp/cs482/iorcapi/IorcApiApplication.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import org.springframework.boot.SpringApplication
66
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
77
import org.springframework.boot.autoconfigure.SpringBootApplication
88

9+
10+
911
//@EnableAutoConfiguration
1012
@SpringBootApplication
1113
open class IorcApiApplication : CommandLineRunner {

src/main/kotlin/edu/ycp/cs482/iorcapi/config/ApplicationConfig.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package edu.ycp.cs482.iorcapi.config
33
import com.mongodb.Mongo
44
import com.mongodb.MongoClient
55
import com.mongodb.MongoClientURI
6+
import graphql.GraphQLError
7+
import graphql.servlet.GraphQLErrorHandler
68
import org.springframework.beans.factory.annotation.Value
79
import org.springframework.context.annotation.Bean
810
import org.springframework.context.annotation.Configuration
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package edu.ycp.cs482.iorcapi.error
2+
3+
import graphql.GraphQLError
4+
import graphql.servlet.GenericGraphQLError
5+
import graphql.servlet.GraphQLErrorHandler
6+
import org.springframework.stereotype.Component
7+
8+
@Component
9+
class CustomGraphQlErrorHandler: GraphQLErrorHandler {
10+
11+
override fun processErrors(errors: MutableList<GraphQLError>?): MutableList<GraphQLError> {
12+
val errorList = mutableListOf<GraphQLError>()
13+
errors!!.mapTo(errorList) { GenericGraphQLError(it.message) }
14+
return errorList
15+
}
16+
17+
}

src/main/kotlin/edu/ycp/cs482/iorcapi/error/SimpleDataFetcherExceptionHandler.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import graphql.ExceptionWhileDataFetching
44
import graphql.execution.DataFetcherExceptionHandler
55
import graphql.execution.DataFetcherExceptionHandlerParameters
66
import graphql.execution.ExecutionPath
7+
import graphql.execution.SimpleDataFetcherExceptionHandler
78
import graphql.language.SourceLocation
89
import org.slf4j.Logger
910
import org.slf4j.LoggerFactory
11+
import org.springframework.stereotype.Component
1012

11-
12-
class SimpleDataFetcherExceptionHandler : DataFetcherExceptionHandler {
13+
@Component
14+
class CustomDataFetcherExceptionHandler : SimpleDataFetcherExceptionHandler() {
1315

1416
override fun accept(handlerParameters: DataFetcherExceptionHandlerParameters) {
1517
val exception = handlerParameters.exception
@@ -23,6 +25,6 @@ class SimpleDataFetcherExceptionHandler : DataFetcherExceptionHandler {
2325

2426
companion object {
2527

26-
private val log = LoggerFactory.getLogger(SimpleDataFetcherExceptionHandler::class.java)
28+
private val log = LoggerFactory.getLogger(CustomDataFetcherExceptionHandler::class.java)
2729
}
2830
}

0 commit comments

Comments
 (0)