Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RPServer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Josh Ji
RPServer
Commits
969b0f59
Commit
969b0f59
authored
1 year ago
by
Josh Ji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zipkin
parent
72c83d6d
Pipeline
#5708
failed with stage
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
52 additions
and
16 deletions
+52
-16
Dockerfile
Dockerfile
+1
-1
pom.xml
pom.xml
+14
-3
src/main/java/com/example/rpserver/RpServerApplication.java
src/main/java/com/example/rpserver/RpServerApplication.java
+7
-0
src/main/java/com/example/rpserver/controller/MakeCredential.java
.../java/com/example/rpserver/controller/MakeCredential.java
+11
-5
src/main/java/com/example/rpserver/model/Credential.java
src/main/java/com/example/rpserver/model/Credential.java
+1
-1
src/main/java/com/example/rpserver/model/FidoUser.java
src/main/java/com/example/rpserver/model/FidoUser.java
+1
-1
src/main/resources/application.yml
src/main/resources/application.yml
+10
-1
src/main/resources/static/js/webauthn.js
src/main/resources/static/js/webauthn.js
+1
-0
src/main/resources/templates/index.html
src/main/resources/templates/index.html
+3
-3
src/main/resources/templates/profile.html
src/main/resources/templates/profile.html
+3
-1
No files found.
Dockerfile
View file @
969b0f59
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#WORKDIR /tmp
#WORKDIR /tmp
#RUN mvn clean package -DskipTests
#RUN mvn clean package -DskipTests
FROM
openjdk:
11-jre-slim
FROM
openjdk:
23-slim-bullseye
#COPY --from=build /tmp/target/*.jar app.jar
#COPY --from=build /tmp/target/*.jar app.jar
COPY
target/*.jar app.jar
COPY
target/*.jar app.jar
EXPOSE
443
EXPOSE
443
...
...
This diff is collapsed.
Click to expand it.
pom.xml
View file @
969b0f59
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<parent>
<parent>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.7.4
</version>
<version>
3.1.2
</version>
<relativePath/>
<!-- lookup parent from repository -->
<relativePath/>
<!-- lookup parent from repository -->
</parent>
</parent>
<groupId>
com.example
</groupId>
<groupId>
com.example
</groupId>
...
@@ -16,13 +16,12 @@
...
@@ -16,13 +16,12 @@
<name>
RPServer
</name>
<name>
RPServer
</name>
<description>
RPServer
</description>
<description>
RPServer
</description>
<properties>
<properties>
<java.version>
1
1
</java.version>
<java.version>
1
7
</java.version>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
<version>
2.7.5
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
@@ -62,6 +61,18 @@
...
@@ -62,6 +61,18 @@
<artifactId>
cbor
</artifactId>
<artifactId>
cbor
</artifactId>
<version>
0.8
</version>
<version>
0.8
</version>
</dependency>
</dependency>
<dependency>
<groupId>
io.micrometer
</groupId>
<artifactId>
micrometer-tracing-bridge-brave
</artifactId>
</dependency>
<dependency>
<groupId>
io.zipkin.reporter2
</groupId>
<artifactId>
zipkin-reporter-brave
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/example/rpserver/RpServerApplication.java
View file @
969b0f59
...
@@ -2,6 +2,9 @@ package com.example.rpserver;
...
@@ -2,6 +2,9 @@ package com.example.rpserver;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.web.client.RestTemplateBuilder
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.web.client.RestTemplate
;
@SpringBootApplication
@SpringBootApplication
public
class
RpServerApplication
{
public
class
RpServerApplication
{
...
@@ -10,4 +13,8 @@ public class RpServerApplication {
...
@@ -10,4 +13,8 @@ public class RpServerApplication {
SpringApplication
.
run
(
RpServerApplication
.
class
,
args
);
SpringApplication
.
run
(
RpServerApplication
.
class
,
args
);
}
}
@Bean
RestTemplate
restTemplate
(
RestTemplateBuilder
builder
){
return
builder
.
build
();
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/example/rpserver/controller/MakeCredential.java
View file @
969b0f59
...
@@ -54,8 +54,7 @@ public class MakeCredential {
...
@@ -54,8 +54,7 @@ public class MakeCredential {
@RequestParam
(
"attachment"
)
String
attachment
,
@RequestParam
(
"attachment"
)
String
attachment
,
@RequestParam
(
"username"
)
String
username
)
@RequestParam
(
"username"
)
String
username
)
{
{
logger
.
info
(
"timestamp beginMakeCredential {}"
,
System
.
currentTimeMillis
());
byte
[]
userIdBytes
=
new
byte
[
32
];
byte
[]
userIdBytes
=
new
byte
[
32
];
secureRandom
.
nextBytes
(
userIdBytes
);
secureRandom
.
nextBytes
(
userIdBytes
);
...
@@ -90,7 +89,7 @@ public class MakeCredential {
...
@@ -90,7 +89,7 @@ public class MakeCredential {
FidoUser
fidoUser
=
new
FidoUser
(
userIdBytes
,
challenge
.
toString
(),
username
);
FidoUser
fidoUser
=
new
FidoUser
(
userIdBytes
,
challenge
.
toString
(),
username
);
userRepository
.
save
(
fidoUser
);
userRepository
.
save
(
fidoUser
);
logger
.
info
(
"timestamp beginMakeCredentialReturn {}"
,
System
.
currentTimeMillis
());
return
ResponseEntity
.
ok
(
options
);
return
ResponseEntity
.
ok
(
options
);
}
}
...
@@ -101,6 +100,8 @@ public class MakeCredential {
...
@@ -101,6 +100,8 @@ public class MakeCredential {
@RequestParam
(
"clientDataJSON"
)
byte
[]
clientDataJSONBytes
,
@RequestParam
(
"clientDataJSON"
)
byte
[]
clientDataJSONBytes
,
@RequestParam
(
"attestationObject"
)
byte
[]
attestationObjectBytes
,
@RequestParam
(
"attestationObject"
)
byte
[]
attestationObjectBytes
,
@RequestHeader
Map
<
String
,
String
>
headers
){
@RequestHeader
Map
<
String
,
String
>
headers
){
logger
.
info
(
"timestamp finishMakeCredential {}"
,
System
.
currentTimeMillis
());
// apply base64 decoding
// apply base64 decoding
clientDataJSONBytes
=
Base64Util
.
decode
(
clientDataJSONBytes
);
clientDataJSONBytes
=
Base64Util
.
decode
(
clientDataJSONBytes
);
attestationObjectBytes
=
Base64Util
.
decode
(
attestationObjectBytes
);
attestationObjectBytes
=
Base64Util
.
decode
(
attestationObjectBytes
);
...
@@ -143,7 +144,7 @@ public class MakeCredential {
...
@@ -143,7 +144,7 @@ public class MakeCredential {
null
,
null
,
user
.
getUserName
(),
user
.
getUserName
(),
rawId
));
rawId
));
logger
.
info
(
"timestamp finishMakeCredentialReturn {}"
,
System
.
currentTimeMillis
());
return
ResponseEntity
.
ok
().
body
(
new
Response
(
true
,
"Successfully created credential"
,
identityFromIDP
));
return
ResponseEntity
.
ok
().
body
(
new
Response
(
true
,
"Successfully created credential"
,
identityFromIDP
));
}
}
...
@@ -188,8 +189,12 @@ public class MakeCredential {
...
@@ -188,8 +189,12 @@ public class MakeCredential {
@Autowired
@Autowired
Environment
env
;
Environment
env
;
@Autowired
RestTemplate
restTemplate
;
private
String
askIDP
(
String
[]
param
){
private
String
askIDP
(
String
[]
param
){
RestTemplate
restTemplate
=
new
RestTemplate
();
logger
.
info
(
"timestamp askIDP {}"
,
System
.
currentTimeMillis
());
String
idp_addr
=
env
.
getProperty
(
"server.idp.url"
);
String
idp_addr
=
env
.
getProperty
(
"server.idp.url"
);
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
String
uri
=
idp_addr
;
String
uri
=
idp_addr
;
...
@@ -209,6 +214,7 @@ public class MakeCredential {
...
@@ -209,6 +214,7 @@ public class MakeCredential {
break
;
break
;
}
}
}
}
logger
.
info
(
"timestamp askIDPReturn {}"
,
System
.
currentTimeMillis
());
return
restTemplate
.
postForObject
(
uri
,
map
,
String
.
class
);
return
restTemplate
.
postForObject
(
uri
,
map
,
String
.
class
);
}
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/example/rpserver/model/Credential.java
View file @
969b0f59
...
@@ -2,7 +2,7 @@ package com.example.rpserver.model;
...
@@ -2,7 +2,7 @@ package com.example.rpserver.model;
import
com.webauthn4j.data.PublicKeyCredentialEntity
;
import
com.webauthn4j.data.PublicKeyCredentialEntity
;
import
ja
vax
.persistence.*
;
import
ja
karta
.persistence.*
;
import
java.util.Date
;
import
java.util.Date
;
@Entity
@Entity
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/example/rpserver/model/FidoUser.java
View file @
969b0f59
package
com.example.rpserver.model
;
package
com.example.rpserver.model
;
import
ja
vax
.persistence.*
;
import
ja
karta
.persistence.*
;
@Entity
@Entity
@Table
@Table
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/application.yml
View file @
969b0f59
...
@@ -35,4 +35,13 @@ spring:
...
@@ -35,4 +35,13 @@ spring:
ddl-auto
:
update
ddl-auto
:
update
properties
:
properties
:
hibernate
:
hibernate
:
dialect
:
org.hibernate.dialect.H2Dialect
dialect
:
org.hibernate.dialect.H2Dialect
\ No newline at end of file
application
:
name
:
rpserver
management
:
tracing
:
sampling
:
probability
:
1
zipkin
:
tracing
:
endpoint
:
http://zipkin:9411/api/v2/spans
This diff is collapsed.
Click to expand it.
src/main/resources/static/js/webauthn.js
View file @
969b0f59
...
@@ -259,6 +259,7 @@ function serializeUvm(uvm) {
...
@@ -259,6 +259,7 @@ function serializeUvm(uvm) {
}
}
function
registerNewCredential
()
{
function
registerNewCredential
()
{
console
.
log
(
"
timestamp registerNewCredential
"
+
Date
.
now
());
const
advancedOptions
=
{};
const
advancedOptions
=
{};
if
(
isChecked
(
'
#switch-rr
'
))
{
if
(
isChecked
(
'
#switch-rr
'
))
{
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/templates/index.html
View file @
969b0f59
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<head>
<head>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"shortcut icon"
href=
"favicon.ico"
>
<link
rel=
"shortcut icon"
href=
"
/
favicon.ico"
>
<link
rel=
"stylesheet"
href=
"https://code.getmdl.io/1.3.0/material.teal-pink.min.css"
/>
<link
rel=
"stylesheet"
href=
"https://code.getmdl.io/1.3.0/material.teal-pink.min.css"
/>
<script
src=
"//code.getmdl.io/1.3.0/material.min.js"
></script>
<script
src=
"//code.getmdl.io/1.3.0/material.min.js"
></script>
<!-- CSS only -->
<!-- CSS only -->
...
@@ -117,7 +117,7 @@
...
@@ -117,7 +117,7 @@
<!-- <p style="padding-top: 10px; text-align: center; color: gray;"> For Demo</p>-->
<!-- <p style="padding-top: 10px; text-align: center; color: gray;"> For Demo</p>-->
<!-- </div>-->
<!-- </div>-->
<div
>
<div
>
<img
src=
"img/logo4.png"
style=
"width: 250px;display:block; margin:auto;"
alt=
"logo2"
>
<img
src=
"
/
img/logo4.png"
style=
"width: 250px;display:block; margin:auto;"
alt=
"logo2"
>
<h1
style=
"text-align: center"
>
FIDO DEMO
</h1>
<h1
style=
"text-align: center"
>
FIDO DEMO
</h1>
</div>
</div>
<!-- <div class="col">-->
<!-- <div class="col">-->
...
@@ -175,7 +175,7 @@
...
@@ -175,7 +175,7 @@
<!-- JavaScript Bundle with Popper -->
<!-- JavaScript Bundle with Popper -->
<script
src=
"https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"
integrity=
"sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"
integrity=
"sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8"
crossorigin=
"anonymous"
></script>
<script
src=
"js/webauthn.js"
></script>
<script
src=
"
/
js/webauthn.js"
></script>
<script>
<script>
// override fetchCredentials in "js/webauthn.js"
// override fetchCredentials in "js/webauthn.js"
function
fetchCredentials
(){
function
fetchCredentials
(){
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/templates/profile.html
View file @
969b0f59
...
@@ -9,7 +9,9 @@
...
@@ -9,7 +9,9 @@
</head>
</head>
<body>
<body>
<script>
console
.
log
(
"
timestamp viewProfile
"
+
Date
.
now
());
</script>
<!--navbar-->
<!--navbar-->
<nav
class=
"navbar bg-light navbar-light"
>
<nav
class=
"navbar bg-light navbar-light"
>
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
...
...
This diff is collapsed.
Click to expand it.
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