Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vetle.Hjelmtvedt
inf226-2021-inchat
Commits
da010e2a
Commit
da010e2a
authored
Nov 10, 2021
by
Mathias Vehus
Browse files
The protection flags for the session cookie has been added.
parent
5ed54ee1
Changes
3
Hide whitespace changes
Inline
Side-by-side
.idea/runConfigurations.xml
View file @
da010e2a
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"RunConfigurationProducerService"
>
<option
name=
"ignoredProducers"
>
<set>
<option
value=
"com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer"
/>
</set>
</option>
</component>
</project>
\ No newline at end of file
production.db
View file @
da010e2a
No preview for this file type
src/main/java/inf226/inchat/Handler.java
View file @
da010e2a
...
...
@@ -6,6 +6,8 @@ import javax.servlet.http.HttpServletResponse;
import
javax.servlet.ServletException
;
import
javax.servlet.http.Cookie
;
import
java.io.IOException
;
import
org.eclipse.jetty.server.CookieCutter
;
import
org.eclipse.jetty.server.Server
;
import
org.eclipse.jetty.server.Request
;
import
org.eclipse.jetty.server.handler.AbstractHandler
;
...
...
@@ -137,7 +139,10 @@ public class Handler extends AbstractHandler
final
Stored
<
Account
>
account
=
session
.
value
.
account
;
// User is now logged in with a valid sesion.
// We set the session cookie to keep the user logged in:
response
.
addCookie
(
new
Cookie
(
"session"
,
session
.
identity
.
toString
()));
Cookie
cookie
=
new
Cookie
(
"session"
,
session
.
identity
.
toString
());
cookie
.
setHttpOnly
(
true
);
cookie
.
setSecure
(
true
);
response
.
addCookie
(
cookie
);
final
PrintWriter
out
=
response
.
getWriter
();
// Handle a logged in request.
...
...
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