Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LilleConnect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giorgio Utzeri
LilleConnect
Commits
029bcb33
Commit
029bcb33
authored
1 month ago
by
Tom Dequesnes
Browse files
Options
Downloads
Patches
Plain Diff
Suppression des System out
parent
c25cfce5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
WEB-INF/src/controleurs/APIRest.java
+0
-3
0 additions, 3 deletions
WEB-INF/src/controleurs/APIRest.java
WEB-INF/src/controleurs/JwtManager.java
+0
-15
0 additions, 15 deletions
WEB-INF/src/controleurs/JwtManager.java
WEB-INF/src/dao/DS.java
+2
-2
2 additions, 2 deletions
WEB-INF/src/dao/DS.java
with
2 additions
and
20 deletions
WEB-INF/src/controleurs/APIRest.java
+
0
−
3
View file @
029bcb33
...
...
@@ -24,13 +24,10 @@ public class APIRest extends HttpServlet {
if
(
authorization
==
null
||
!
authorization
.
startsWith
(
"Bearer"
))
{
return
false
;
}
System
.
out
.
println
(
"Authorization Header: "
+
authorization
);
String
token
=
authorization
.
substring
(
"Bearer"
.
length
()).
trim
();
try
{
Claims
claims
=
JwtManager
.
decodeJWT
(
token
);
System
.
out
.
println
(
"Token décodé : "
+
claims
.
toString
());
System
.
out
.
println
(
"Le login est : "
+
claims
.
getSubject
());
req
.
setAttribute
(
"login"
,
claims
.
getSubject
());
return
true
;
}
catch
(
Exception
e
)
{
...
...
This diff is collapsed.
Click to expand it.
WEB-INF/src/controleurs/JwtManager.java
+
0
−
15
View file @
029bcb33
...
...
@@ -43,19 +43,4 @@ public class JwtManager {
return
claims
;
}
public
static
void
main
(
String
args
[])
{
System
.
out
.
println
(
JwtManager
.
SECRET_KEY
);
String
token
=
JwtManager
.
createJWT
(
"Toto"
);
System
.
out
.
println
(
token
);
Claims
claims
=
null
;
try
{
claims
=
JwtManager
.
decodeJWT
(
token
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"jeton invalide "
+
e
.
getMessage
());
System
.
exit
(
1
);
}
System
.
out
.
println
(
claims
.
toString
());
}
}
This diff is collapsed.
Click to expand it.
WEB-INF/src/dao/DS.java
+
2
−
2
View file @
029bcb33
...
...
@@ -17,7 +17,7 @@ public class DS {
this
.
login
=
ConfigLoader
.
getProperty
(
"login"
);
this
.
password
=
ConfigLoader
.
getProperty
(
"mdp"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
System
.
err
.
println
(
e
.
getMessage
());
}
}
...
...
@@ -26,7 +26,7 @@ public class DS {
Connection
con
=
DriverManager
.
getConnection
(
url
,
login
,
password
);
return
con
;
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Il y a une erreur lors de la connection : "
+
e
.
getMessage
());
System
.
err
.
println
(
"Il y a une erreur lors de la connection : "
+
e
.
getMessage
());
return
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment