Package com.isfasiel.main.user.web

Source Code of com.isfasiel.main.user.web.UserController

package com.isfasiel.main.user.web;

import java.util.Properties;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.isfasiel.main.base.web.BaseController;
import com.isfasiel.util.data.Data;
import com.isfasiel.util.security.Cryptograph;

@Controller
@RequestMapping(value="/user")
public class UserController extends BaseController {

  @Autowired
  protected Cryptograph cryptograph;
 
  @Resource(name="pp.security")
  protected Properties scProp;
 
  protected String encode(String text) throws Exception{
    if(cryptograph.getKey() == null) {
      cryptograph.init( getContextPath() + "WEB-INF/config/key/" + scProp.getProperty("keyFileName"));
    }
    return cryptograph.encode(text);
  }
 
  protected String decode(String text) throws Exception{
    if(cryptograph.getKey() == null) {
      cryptograph.init(scProp.getProperty("keyFileName"));
    }
    return cryptograph.decode(text);
  }
 
 
  @RequestMapping(value="/create.do")
  public String insertUser() throws Exception{
    Data param = getParam();
    param.add(0,"password", encode(param.getString(0,"pwd")));
    return "user/join";
  }
 
}
TOP

Related Classes of com.isfasiel.main.user.web.UserController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.