U E D R , A S I H C RSS

Spring/탐험스터디/wiki만들기

SimpleWiki

Spring Framework

Spring Security


  • UserDetail - User

    1. SecurityContextHolder
      Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
      
                      String name;
                      if (principal instanceof UserDetails) {
                        name = ((UserDetails)principal).getUsername();
                      } else {
                        name = principal.toString();
                      }
      
    2. Spring dependency injection
      public String write(@RequestParam("title") String title, @RequestParam("contents") String contents, Model model, Principal principal) {
      ...
      page.edit(contents, userRepository.get(principal.getName()));
      ...
      }
      

  • spring security tab library
    • spring security html/js .

<%@ taglib uri="http://www.springframework.org/security/tags" prefix="sec" %>
...
        <sec:authorize ifAllGranted="ROLE_USER">
                <input id="contents_edit" type="textarea" class="page_edit" value="${page.contents}" />
                <a href="#" class="page_edit" id="save">save</a>
        </sec:authorize>
...
        <sec:authorize url="/login">
                <a href="logout">Logout</a>
        </sec:authorize>

  • Spring Security Role Voter "ROLE_" . .

Hibernate

  • ORM(Object Relation Mapping) 크. Java persistence, EJB3.0 .
  • Lisence : LGPL

JSP

Markdown

  • Markdown .
    • Markdown : wiki:Markdown
    • Java Markdown implementation Pegdown 택했.
      • MarkdownJ, MarkdownPapers Pegdown 통한 페 편하 .
      • 한 Pegdown
        1. pom.xml dependency
          <dependency>
                  <groupId>org.pegdown</groupId>
                  <artifactId>pegdown</artifactId>
                  <version>1.1.0</version>
          </dependency>
          
        2. markdown text html
          String html = new PegDownProcessor().markdownToHtml("markdown text");
          

CGLIB

  • CGLIB (Code Generator Library) (펌) .

8 30


    • 2? 1.5 . 틈틈 ... .
    • !! . .

    • TODO : write/delete security

    • .
      • Markdown (Markdown ) 편 ( !) Markdown 파 pegdown . Java 화(GitHub ) ....
      • pegdown (new Pegdown().markdownToHTML(/* String */) . 하 ㅋㅋ
      • ? . .

      • 한 Mock . . 테 . 테 Mock . ?
        • 트( ) . .
    • .
    • .
      • 한 Spring, Hibernate . CGLib, Spring Security, JSP, Session .
      • .

      • pegdown Markdown 편함
      • . .

9 13



    • .
      • , !

9 19



    • . 흐.....
    • ( 9) jsp pageContext.getAttribute("page") Response page 10 pageContext.getRequst().getAttribute()( request.getAttribute) page . ? . 한
      • Scope .
    • Jasper JSP java 환해 .
      • home.jsp home_jsp.java

9 20


    • login.jsp .
      • Remember me 함.
    • save .

    • login, signup
      • spring security tag library ifAllGranted, ifNotGranted .
    • view
    • , ?
      • 통 페 GET .
      • url mapping ?
      • pagdown page localhost:8080/simplewiki/ localhost:8080/ .
        • localhost:8080/ ?
      • ViewResolver? Intercept Handler?
    • . .
    • mac eclipse tomcat caltalina

9 27



    • PageTitle !! , PathVariable url path .
      • getServletPath()

10 4

10 11



    • Page User . Page History . history . User id history id . User id (password, e-mail..) .

11 01



    • User 탈퇴 userId 탈퇴한 id 해 User userId(String type) password,..(UserInfo.class) .
      • User UserInfo .( Composite)
      • User UserInfo Nullable Column UserInfo ForeignKey Contraint ..
      • User UserInfo 포함 .
      • 탈퇴 UserInfo field null 화 하... + 탈퇴한 회 flag
      • .
    • () 한 해 . .
    • . 18000 .

11 21



    • Page History
      • url "/" Page Page history 핑하.
        • (page content view, page history view) 큰 행(page view) subset Request parameter .
      • OverLoading ResuestMapping Spring Ambiguous Mapping Exception .
        • RequestMappingHandlerMapping 핑 테 { URL , methods= Method , params=[],headers=[],consumes=[],produces=[],custom=[]} Request .
      • @RequestMapping params 해 파 . RequestMapping .
        • RequestMapping value, Method 트 핸 .
        • @RequestMapping(value = "/helloworld", method = RequestMethod.GET) @RequestMapping(value = "/helloworld", method = RequestMethod.GET, params="param=param") . mapping .

    • Login하 Page
      • FrontPage Login Page create .
        • spring security "/create" url authentication
        • ui Signup하
        • RequestMapping method 해 signup 페 signup
          • ... .. "signup " 할 " ID PASSWORD " Request Name ..
      • Spring Security 해 Signup 페 .

11 29



    • . 황, 키페 backlink ..
    • linkback ?
      • backlink (), linkback backlink하 .

12 6


    • Java Matcher matches() find() substring . 'abcde' 'bcd' matches find .

    • backlink
    • Java Matcher find() matches() .

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:05
Processing time 0.1134 sec