Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
I
Inovasi Daerah Master
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ghitha Dinan
Inovasi Daerah Master
Commits
90cf3f80
Commit
90cf3f80
authored
Dec 08, 2021
by
Ghitha Dinan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sso token
parent
43a35ff0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
32 additions
and
21 deletions
+32
-21
FileConstant.kt
...angkuriang/inovasi/daerah/master/constant/FileConstant.kt
+2
-2
SecurityConstant.kt
...uriang/inovasi/daerah/master/constant/SecurityConstant.kt
+2
-2
UrlConstant.kt
...sangkuriang/inovasi/daerah/master/constant/UrlConstant.kt
+2
-2
TokenInterceptor.kt
...ang/inovasi/daerah/master/interceptor/TokenInterceptor.kt
+3
-3
UserJwt.kt
...co/sangkuriang/inovasi/daerah/master/model/jwt/UserJwt.kt
+1
-1
Helpers.kt
...d/co/sangkuriang/inovasi/daerah/master/utility/Helpers.kt
+14
-3
application.properties
src/main/resources/application.properties
+6
-6
logback.xml
src/main/resources/logback.xml
+2
-2
No files found.
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/constant/FileConstant.kt
View file @
90cf3f80
...
@@ -2,8 +2,8 @@ package id.co.sangkuriang.inovasi.daerah.master.constant
...
@@ -2,8 +2,8 @@ package id.co.sangkuriang.inovasi.daerah.master.constant
import
java.io.File
import
java.io.File
//
const val ROOT_DIR = "D:\\app-files\\inovasi_daerah_master\\files\\"
const
val
ROOT_DIR
=
"D:\\app-files\\inovasi_daerah_master\\files\\"
const
val
ROOT_DIR
=
"/home/inovasi-daerah/data/files/inovasi_daerah_master/"
//
const val ROOT_DIR = "/home/inovasi-daerah/data/files/inovasi_daerah_master/"
//const val ROOT_DIR = "/home/inovasi-daerah-prod/data/files/inovasi_daerah_master/"
//const val ROOT_DIR = "/home/inovasi-daerah-prod/data/files/inovasi_daerah_master/"
val
UPLOAD_DIR
=
"${ROOT_DIR}uploads${File.separator}"
val
UPLOAD_DIR
=
"${ROOT_DIR}uploads${File.separator}"
...
...
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/constant/SecurityConstant.kt
View file @
90cf3f80
...
@@ -2,9 +2,9 @@ package id.co.sangkuriang.inovasi.daerah.master.constant
...
@@ -2,9 +2,9 @@ package id.co.sangkuriang.inovasi.daerah.master.constant
const
val
TOKEN_PREFIX
=
"Bearer "
const
val
TOKEN_PREFIX
=
"Bearer "
const
val
HEADER_STRING
=
"Authorization"
const
val
HEADER_STRING
=
"Authorization"
//
const val AUTH_URL = "http://localhost:8081/auth"
const
val
AUTH_URL
=
"http://localhost:8081/auth"
//const val AUTH_URL = "https://auth.inovasi-daerah.dev.layanan.go.id/auth"
//const val AUTH_URL = "https://auth.inovasi-daerah.dev.layanan.go.id/auth"
const
val
AUTH_URL
=
"http://inovasi-daerah-auth.inovasi-daerah.svc.cluster.local:8081/auth"
//
const val AUTH_URL = "http://inovasi-daerah-auth.inovasi-daerah.svc.cluster.local:8081/auth"
//const val AUTH_URL = "http://inovasi-daerah-auth-prod.inovasi-daerah-prod.svc.cluster.local:8081/auth"
//const val AUTH_URL = "http://inovasi-daerah-auth-prod.inovasi-daerah-prod.svc.cluster.local:8081/auth"
val
USER_ALLOWED_PATH
=
emptyList
<
String
>()
val
USER_ALLOWED_PATH
=
emptyList
<
String
>()
...
...
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/constant/UrlConstant.kt
View file @
90cf3f80
package
id.co.sangkuriang.inovasi.daerah.master.constant
package
id.co.sangkuriang.inovasi.daerah.master.constant
//
const val APPLICATION_URL = "http://localhost:8082"
const
val
APPLICATION_URL
=
"http://localhost:8082"
//const val APPLICATION_URL = "https://application.inovasi-daerah.dev.layanan.go.id"
//const val APPLICATION_URL = "https://application.inovasi-daerah.dev.layanan.go.id"
const
val
APPLICATION_URL
=
"http://inovasi-daerah-application.inovasi-daerah.svc.cluster.local:8082"
//
const val APPLICATION_URL = "http://inovasi-daerah-application.inovasi-daerah.svc.cluster.local:8082"
//const val APPLICATION_URL = "http://inovasi-daerah-application-prod.inovasi-daerah-prod.svc.cluster.local:8082"
//const val APPLICATION_URL = "http://inovasi-daerah-application-prod.inovasi-daerah-prod.svc.cluster.local:8082"
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/interceptor/TokenInterceptor.kt
View file @
90cf3f80
...
@@ -7,7 +7,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature
...
@@ -7,7 +7,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature
import
com.fasterxml.jackson.databind.ObjectMapper
import
com.fasterxml.jackson.databind.ObjectMapper
import
id.co.sangkuriang.inovasi.daerah.master.constant.*
import
id.co.sangkuriang.inovasi.daerah.master.constant.*
import
id.co.sangkuriang.inovasi.daerah.master.helpers.RequestHelpers
import
id.co.sangkuriang.inovasi.daerah.master.helpers.RequestHelpers
import
id.co.sangkuriang.inovasi.daerah.master.model.jwt.UserJwt
Sso
import
id.co.sangkuriang.inovasi.daerah.master.model.jwt.UserJwt
import
id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import
id.co.sangkuriang.inovasi.daerah.master.model.response.ReturnData
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
import
org.springframework.security.core.context.SecurityContextHolder
import
org.springframework.security.core.context.SecurityContextHolder
...
@@ -97,8 +97,8 @@ class TokenInterceptor : Filter {
...
@@ -97,8 +97,8 @@ class TokenInterceptor : Filter {
val
objectMapper
=
ObjectMapper
()
val
objectMapper
=
ObjectMapper
()
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
)
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
)
val
users
:
UserJwt
Sso
=
val
users
:
UserJwt
=
objectMapper
.
readValue
(
objectMapper
.
writeValueAsString
(
reqAuthDetail
.
data
),
UserJwt
Sso
::
class
.
java
)
objectMapper
.
readValue
(
objectMapper
.
writeValueAsString
(
reqAuthDetail
.
data
),
UserJwt
::
class
.
java
)
var
audience
=
"user-admin"
var
audience
=
"user-admin"
if
(
users
.
roleId
==
ROLE_USER_ID
)
{
if
(
users
.
roleId
==
ROLE_USER_ID
)
{
...
...
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/model/jwt/UserJwt
Sso
.kt
→
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/model/jwt/UserJwt.kt
View file @
90cf3f80
...
@@ -4,7 +4,7 @@ import id.co.sangkuriang.inovasi.daerah.master.pojo.Province
...
@@ -4,7 +4,7 @@ import id.co.sangkuriang.inovasi.daerah.master.pojo.Province
import
id.co.sangkuriang.inovasi.daerah.master.pojo.Regency
import
id.co.sangkuriang.inovasi.daerah.master.pojo.Regency
import
id.co.sangkuriang.inovasi.daerah.master.pojo.Role
import
id.co.sangkuriang.inovasi.daerah.master.pojo.Role
data class
UserJwt
Sso
(
data class
UserJwt
(
var
id
:
String
?
=
null
,
var
id
:
String
?
=
null
,
...
...
src/main/kotlin/id/co/sangkuriang/inovasi/daerah/master/utility/Helpers.kt
View file @
90cf3f80
...
@@ -4,7 +4,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature
...
@@ -4,7 +4,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature
import
com.fasterxml.jackson.databind.ObjectMapper
import
com.fasterxml.jackson.databind.ObjectMapper
import
id.co.sangkuriang.inovasi.daerah.master.constant.UPLOAD_ICON_APPLICATION_CATEGORY_DIR
import
id.co.sangkuriang.inovasi.daerah.master.constant.UPLOAD_ICON_APPLICATION_CATEGORY_DIR
import
id.co.sangkuriang.inovasi.daerah.master.constant.UPLOAD_IMAGE_APPLICATION_CATEGORY_DIR
import
id.co.sangkuriang.inovasi.daerah.master.constant.UPLOAD_IMAGE_APPLICATION_CATEGORY_DIR
import
id.co.sangkuriang.inovasi.daerah.master.model.jwt.UserJwtSso
import
id.co.sangkuriang.inovasi.daerah.master.model.jwt.UserJwt
import
id.co.sangkuriang.inovasi.daerah.master.pojo.Users
import
org.apache.commons.io.FileUtils
import
org.apache.commons.io.FileUtils
import
org.springframework.security.core.context.SecurityContextHolder
import
org.springframework.security.core.context.SecurityContextHolder
import
org.springframework.web.multipart.MultipartFile
import
org.springframework.web.multipart.MultipartFile
...
@@ -14,12 +15,22 @@ import java.net.MalformedURLException
...
@@ -14,12 +15,22 @@ import java.net.MalformedURLException
import
java.net.URL
import
java.net.URL
import
javax.servlet.http.HttpServletRequest
import
javax.servlet.http.HttpServletRequest
fun
getUsers
Login
():
UserJwtSso
?
{
fun
getUsers
Jwt
():
UserJwt
?
{
return
try
{
return
try
{
val
principal
=
SecurityContextHolder
.
getContext
().
authentication
.
principal
as
Any
val
principal
=
SecurityContextHolder
.
getContext
().
authentication
.
principal
as
Any
val
objectMapper
=
ObjectMapper
()
val
objectMapper
=
ObjectMapper
()
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
)
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
)
objectMapper
.
readValue
(
principal
.
toString
(),
UserJwtSso
::
class
.
java
)
objectMapper
.
readValue
(
principal
.
toString
(),
UserJwt
::
class
.
java
)
}
catch
(
e
:
Exception
)
{
null
}
}
fun
getUserLogin
():
Users
?
{
return
try
{
val
objectMapper
=
ObjectMapper
()
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
)
objectMapper
.
readValue
(
objectMapper
.
writeValueAsString
(
getUserLogin
()),
Users
::
class
.
java
)
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
null
null
}
}
...
...
src/main/resources/application.properties
View file @
90cf3f80
...
@@ -5,14 +5,14 @@ server.port=8080
...
@@ -5,14 +5,14 @@ server.port=8080
# DATABASE CONFIG
# DATABASE CONFIG
# local
# local
#
spring.datasource.url=jdbc:postgresql://localhost:5432/inovasi_daerah_backup
spring.datasource.url
=
jdbc:postgresql://localhost:5432/inovasi_daerah_backup
#
spring.datasource.username=postgres
spring.datasource.username
=
postgres
#
spring.datasource.password=root
spring.datasource.password
=
root
# dev
# dev
spring.datasource.url
=
jdbc:postgresql://pg-dev.spbe.sangkuriang.co.id:5432/inovasi_daerah_db
#
spring.datasource.url=jdbc:postgresql://pg-dev.spbe.sangkuriang.co.id:5432/inovasi_daerah_db
spring.datasource.username
=
u_inovasi_daerah
#
spring.datasource.username=u_inovasi_daerah
spring.datasource.password
=
wV9Tnx6S8TmmUYXdgkmN4pzreSD3RE
#
spring.datasource.password=wV9Tnx6S8TmmUYXdgkmN4pzreSD3RE
# prod
# prod
#spring.datasource.url=jdbc:postgresql://pg.spbe-prd.sangkuriang.co.id:5432/inovasi_daerah_db
#spring.datasource.url=jdbc:postgresql://pg.spbe-prd.sangkuriang.co.id:5432/inovasi_daerah_db
...
...
src/main/resources/logback.xml
View file @
90cf3f80
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
<!-- configuration file for LogBack (slf4J implementation)
<!-- configuration file for LogBack (slf4J implementation)
See here for more details: http://gordondickens.com/wordpress/2013/03/27/sawing-through-the-java-loggers/ -->
See here for more details: http://gordondickens.com/wordpress/2013/03/27/sawing-through-the-java-loggers/ -->
<configuration
scan=
"true"
scanPeriod=
"30 seconds"
>
<configuration
scan=
"true"
scanPeriod=
"30 seconds"
>
<!-- <property name="DEV_HOME" value="D://app-files//inovasi_daerah_master//log"/>--
>
<property
name=
"DEV_HOME"
value=
"D://app-files//inovasi_daerah_master//log"
/
>
<property
name=
"DEV_HOME"
value=
"/home/inovasi-daerah/data/log/inovasi_daerah_master"
/
>
<!-- <property name="DEV_HOME" value="/home/inovasi-daerah/data/log/inovasi_daerah_master"/>--
>
<!-- <property name="DEV_HOME" value="/home/inovasi-daerah-prod/data/log/inovasi_daerah_master"/>-->
<!-- <property name="DEV_HOME" value="/home/inovasi-daerah-prod/data/log/inovasi_daerah_master"/>-->
<appender
name=
"ACCESS-LOG"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<appender
name=
"ACCESS-LOG"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment