Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
Ecsite
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shoei.kanno
Ecsite
Commits
bb5056ed
Commit
bb5056ed
authored
Oct 15, 2020
by
DESKTOP-FI5PFC1\tevir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TOP画面ルーティング途中
parent
2c83df65
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
18 deletions
+47
-18
SecurityConfig.java
src/main/java/com/example/SecurityConfig.java
+10
-10
EcsiteController.java
src/main/java/com/example/web/EcsiteController.java
+28
-0
index.html
src/main/resources/templates/index.html
+9
-8
No files found.
src/main/java/com/example/SecurityConfig.java
View file @
bb5056ed
...
...
@@ -21,23 +21,23 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter{
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
authorizeRequests
()
.
mvcMatchers
(
"/limited/login"
).
permitAll
()
.
mvcMatchers
(
"/limited/admin/**"
).
hasRole
(
"ADMIN"
)
.
anyRequest
().
authenticated
()
.
mvcMatchers
(
"/limited/login"
).
permitAll
()
//ログイン前でもアクセス可能なURLの指定
.
mvcMatchers
(
"/limited/admin/**"
).
hasRole
(
"ADMIN"
)
//ADMIN権限のユーザーのみアクセスできるURLの指定
.
anyRequest
().
authenticated
()
//ログイン前は他のアドレスにログインできないよう指定
.
and
()
.
formLogin
()
.
loginProcessingUrl
(
"/login"
)
.
loginPage
(
"/limited/login"
)
.
defaultSuccessUrl
(
"/limited/top"
,
true
)
.
usernameParameter
(
"email"
).
passwordParameter
(
"password"
)
.
loginProcessingUrl
(
"/login"
)
//ログイン処理でpostするURL
.
loginPage
(
"/limited/login"
)
//ログインページのURL
.
defaultSuccessUrl
(
"/limited/top"
,
true
)
//ログイン成功時のURL
.
usernameParameter
(
"email"
).
passwordParameter
(
"password"
)
//ログインのパラメーター指定
.
and
()
.
logout
()
.
invalidateHttpSession
(
true
)
.
deleteCookies
(
"JSESSIONID"
)
.
logoutSuccessUrl
(
"/limited/login"
);
.
deleteCookies
(
"JSESSIONID"
)
//ログアウト時キャッシュを削除する処理
.
logoutSuccessUrl
(
"/limited/login"
);
//ログアウト後に表示するURL
}
@Bean
@Bean
//パスワードのハッシュか
PasswordEncoder
passwordEncoder
(){
return
new
Pbkdf2PasswordEncoder
();
}
...
...
src/main/java/com/example/web/EcsiteController.java
0 → 100644
View file @
bb5056ed
package
com
.
example
.
web
;
import
org.springframework.security.core.annotation.AuthenticationPrincipal
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
com.example.domain.User
;
import
com.example.service.LoginUser
;
@Controller
@RequestMapping
(
"limited"
)
public
class
EcsiteController
{
//トップ画面遷移(現在のログインユーザーデータもmodelに格納済み)
@GetMapping
(
"top"
)
public
String
top
(
Model
model
,
@AuthenticationPrincipal
LoginUser
userDetails
)
{
User
user
=
userDetails
.
getUser
();
model
.
addAttribute
(
"user"
,
user
);
return
"index"
;
}
@GetMapping
(
"list"
)
public
String
list
()
{
return
"Hello world"
;
}
}
src/main/resources/templates/index.html
View file @
bb5056ed
<!DOCTYPE html>
<html
class=
"no-js"
lang=
"ja"
>
<html
class=
"no-js"
lang=
"ja"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"utf-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge,chrome=1"
/>
...
...
@@ -74,6 +74,7 @@
</ul>-->
<!--</div> /.navbar-collapse -->
<!--</div> /.container -->
</div>
</nav>
</header>
...
...
@@ -83,7 +84,7 @@
<div
class=
"col-md-12"
>
<form
class=
"form-inline col-md-12 wow fadeInDown animated"
>
<div
class=
"form-group"
>
<input
type=
"email"
class=
"form-control subscribe"
id=
"email"
placeholder=
"Search..."
>
<input
type=
"email"
class=
"form-control subscribe"
id=
"email"
placeholder=
"Search..."
/
>
<button
class=
"suscribe-btn"
><i
class=
"pe-7s-search"
></i></button>
</div>
</form>
<!-- end /. form -->
...
...
@@ -104,27 +105,27 @@
<!-- Wrapper for slides -->
<div
class=
"carousel-inner"
role=
"listbox"
>
<div
class=
"item active"
>
<img
src=
"images/スニーカー1.jpg"
width=
"1648"
height=
"600"
alt=
""
>
<img
src=
"images/スニーカー1.jpg"
width=
"1648"
height=
"600"
alt=
""
/
>
<div
class=
"carousel-caption"
>
<h2>
LIMITED SHOES
</h2>
<h3><Span>
SALE SITE
</Span></h3>
<a
th:href=
"
http://localhost:8080/limited/list
"
>
Go To
</a>
<a
th:href=
"
@{http://localhost:8080/limited/list}
"
>
Go To
</a>
</div>
</div>
<div
class=
"item"
>
<img
src=
"images/スニーカー1.jpg"
width=
"1648"
height=
"600"
alt=
""
>
<img
src=
"images/スニーカー1.jpg"
width=
"1648"
height=
"600"
alt=
""
/
>
<div
class=
"carousel-caption"
>
<h2>
LIMITED SHOES
</h2>
<h3><Span>
SALE SITE
</Span></h3>
<a
th:href=
"
http://localhost:8080/limited/list
"
>
Go To
</a>
<a
th:href=
"
@{http://localhost:8080/limited/list}
"
>
Go To
</a>
</div>
</div>
<div
class=
"item "
>
<img
src=
"images/スニーカー1.jpg"
width=
"1648"
height=
"600"
alt=
""
>
<img
src=
"images/スニーカー1.jpg"
width=
"1648"
height=
"600"
alt=
""
/
>
<div
class=
"carousel-caption"
>
<h2>
LIMITED SHOES
</h2>
<h3><Span>
SALE SITE
</Span></h3>
<a
th:href=
"
http://localhost:8080/limited/list
"
>
Go To
</a>
<a
th:href=
"
@{http://localhost:8080/limited/list}
"
>
Go To
</a>
</div>
</div>
</div>
...
...
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