(158) - 对配置,代码必要的地方添加注释,方便理解

0.6
LSZ 2016-08-20 15:48:01 +08:00
parent 8a826aa0d2
commit b311d47107
19 changed files with 57 additions and 3 deletions

View File

@ -7,6 +7,8 @@ import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
* Domain,
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
public abstract class AbstractDomain implements Serializable { public abstract class AbstractDomain implements Serializable {
@ -17,9 +19,13 @@ public abstract class AbstractDomain implements Serializable {
*/ */
protected int id; protected int id;
/**
*
*/
protected boolean archived; protected boolean archived;
/** /**
* Domain business guid. * Domain business guid.
* Id
*/ */
protected String guid = GuidGenerator.generate(); protected String guid = GuidGenerator.generate();

View File

@ -12,7 +12,10 @@ import javax.sql.DataSource;
import static com.monkeyk.sos.infrastructure.CacheConstants.CLIENT_DETAILS_CACHE; import static com.monkeyk.sos.infrastructure.CacheConstants.CLIENT_DETAILS_CACHE;
/** /**
* Add <i>archived = 0</i> condition * ClientDetailsService, ( archived = 0)
* SQL <i>archived = 0</i>
* <p/>
*
* *
* @author Shengzhao Li * @author Shengzhao Li
*/ */

View File

@ -13,6 +13,8 @@ import static com.monkeyk.sos.infrastructure.CacheConstants.REFRESH_TOKEN_CACHE;
/** /**
* 2016/7/26 * 2016/7/26
* <p/>
* TokenStore,
* *
* @author Shengzhao Li * @author Shengzhao Li
*/ */

View File

@ -6,6 +6,8 @@ import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
* OAuth Client, ClientDetails
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
public class OauthClientDetails implements Serializable { public class OauthClientDetails implements Serializable {

View File

@ -5,6 +5,8 @@ import com.monkeyk.sos.domain.shared.Repository;
import java.util.List; import java.util.List;
/** /**
* OAuth Repository
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
public interface OauthRepository extends Repository { public interface OauthRepository extends Repository {

View File

@ -5,6 +5,8 @@ import org.springframework.security.oauth2.common.util.RandomValueStringGenerato
import java.util.UUID; import java.util.UUID;
/** /**
*
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
public abstract class GuidGenerator { public abstract class GuidGenerator {

View File

@ -1,6 +1,11 @@
package com.monkeyk.sos.domain.shared; package com.monkeyk.sos.domain.shared;
/** /**
* Repository ,
*
* <p/>
* Repository DDD
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */

View File

@ -11,6 +11,8 @@ import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
* Spring Security UserDetails
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
public class WdcyUserDetails implements UserDetails { public class WdcyUserDetails implements UserDetails {

View File

@ -1,6 +1,8 @@
package com.monkeyk.sos.domain.user; package com.monkeyk.sos.domain.user;
/** /**
*
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
public enum Privilege { public enum Privilege {

View File

@ -8,6 +8,8 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
*
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
public class User extends AbstractDomain { public class User extends AbstractDomain {

View File

@ -6,6 +6,8 @@ import java.time.format.DateTimeFormatter;
import java.util.Locale; import java.util.Locale;
/** /**
*
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
public abstract class DateUtils { public abstract class DateUtils {
@ -33,7 +35,6 @@ public abstract class DateUtils {
} }
public static String toDateText(LocalDate date, String pattern) { public static String toDateText(LocalDate date, String pattern) {
if (date == null || pattern == null) { if (date == null || pattern == null) {
return null; return null;

View File

@ -4,6 +4,8 @@ import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
/** /**
* 2016/3/25 * 2016/3/25
* <p/>
* , 使MD5
* *
* @author Shengzhao Li * @author Shengzhao Li
*/ */

View File

@ -10,6 +10,8 @@ import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
/** /**
* OAuth ,
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
@Service("oauthService") @Service("oauthService")

View File

@ -21,6 +21,8 @@ import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
* , ,
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
@Service("userService") @Service("userService")

View File

@ -5,6 +5,8 @@ import org.apache.commons.lang.StringUtils;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
* Web
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
public abstract class WebUtils { public abstract class WebUtils {

View File

@ -47,6 +47,9 @@ import java.util.Map;
* 2016/3/8 * 2016/3/8
* <p/> * <p/>
* Restful OAuth API * Restful OAuth API
* <p/>
* OAuth , Restful API,
* access_token
* *
* @author Shengzhao Li * @author Shengzhao Li
* @see org.springframework.security.oauth2.provider.endpoint.TokenEndpoint * @see org.springframework.security.oauth2.provider.endpoint.TokenEndpoint

View File

@ -13,6 +13,8 @@ import java.io.IOException;
/** /**
* 2016/1/30 * 2016/1/30
* <p/>
* IP
* *
* @author Shengzhao Li * @author Shengzhao Li
*/ */

View File

@ -7,6 +7,9 @@ import org.springframework.security.oauth2.provider.AuthorizationRequest;
import org.springframework.security.oauth2.provider.approval.TokenStoreUserApprovalHandler; import org.springframework.security.oauth2.provider.approval.TokenStoreUserApprovalHandler;
/** /**
* OAuth
* grant_type authorization_code, implicit 使
*
* @author Shengzhao Li * @author Shengzhao Li
*/ */
public class OauthUserApprovalHandler extends TokenStoreUserApprovalHandler { public class OauthUserApprovalHandler extends TokenStoreUserApprovalHandler {
@ -17,6 +20,13 @@ public class OauthUserApprovalHandler extends TokenStoreUserApprovalHandler {
} }
/**
* , OauthClientDetails trusted true,
*
* @param authorizationRequest AuthorizationRequest
* @param userAuthentication Authentication
* @return True is approved
*/
public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { public boolean isApproved(AuthorizationRequest authorizationRequest, Authentication userAuthentication) {
if (super.isApproved(authorizationRequest, userAuthentication)) { if (super.isApproved(authorizationRequest, userAuthentication)) {
return true; return true;

View File

@ -3,7 +3,9 @@
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<!--
使用XML方式配置Log4j
-->
<!--console--> <!--console-->
<appender name="Console" class="org.apache.log4j.ConsoleAppender"> <appender name="Console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout"> <layout class="org.apache.log4j.PatternLayout">