当前位置: 首页>>代码示例>>Java>>正文


Java MessageDigestPasswordEncoder类代码示例

本文整理汇总了Java中org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder的典型用法代码示例。如果您正苦于以下问题:Java MessageDigestPasswordEncoder类的具体用法?Java MessageDigestPasswordEncoder怎么用?Java MessageDigestPasswordEncoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MessageDigestPasswordEncoder类属于org.springframework.security.authentication.encoding包,在下文中一共展示了MessageDigestPasswordEncoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MongoPasswordHasherConfiguration

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
public MongoPasswordHasherConfiguration(SecurityConfigurationProperties securityConfig) {
    if (StringUtils.isNotBlank(securityConfig.getMongo().getPasswordHasher())) {
        passwordEncoder = new MessageDigestPasswordEncoder(securityConfig.getMongo().getPasswordHasher());
    } else {
        passwordEncoder = null;
    }
}
 
开发者ID:redlink-gmbh,项目名称:smarti,代码行数:8,代码来源:MongoPasswordHasherConfiguration.java

示例2: addSessionContextToLogging

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
private void addSessionContextToLogging() {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    String tokenValue = "EMPTY";
    if (authentication != null && !Strings.isNullOrEmpty(authentication.getDetails().toString())) {
        MessageDigestPasswordEncoder encoder = new MessageDigestPasswordEncoder("SHA-1");
        tokenValue = encoder.encodePassword(authentication.getDetails().toString(), "not_so_random_salt");
    }
    MDC.put(TOKEN_SESSION_KEY, tokenValue);

    String userValue = "EMPTY";
    if (authentication != null && !Strings.isNullOrEmpty(authentication.getPrincipal().toString())) {
        userValue = authentication.getPrincipal().toString();
    }
    MDC.put(USER_SESSION_KEY, userValue);
}
 
开发者ID:yopeio,项目名称:payment-api,代码行数:16,代码来源:AuthenticationFilter.java

示例3: resetSuperUserPasswordIfNecessary

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
private static final boolean resetSuperUserPasswordIfNecessary(RegisteredUsersTable t,
    boolean newUser, MessageDigestPasswordEncoder mde, CallingContext cc)
    throws ODKEntityPersistException, ODKOverQuotaException, ODKEntityNotFoundException {
  String localSuperUser = t.getUsername();
  String currentRealmString = cc.getUserService().getCurrentRealm().getRealmString();
  String lastKnownRealmString = ServerPreferencesProperties.getLastKnownRealmString(cc);
  if (!newUser && lastKnownRealmString != null && lastKnownRealmString.equals(currentRealmString)) {
    // no need to reset the passwords
    return false;
  }
  // The realm string has changed, so we need to reset the password.
  RealmSecurityInfo r = new RealmSecurityInfo();
  r.setRealmString(currentRealmString);
  r.setBasicAuthHashEncoding(mde.getAlgorithm());

  CredentialsInfo credential;
  try {
    credential = CredentialsInfoBuilderInternal.build(localSuperUser, r, "aggregate");
  } catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
    throw new IllegalStateException("unrecognized algorithm");
  }
  t.setDigestAuthPassword(credential.getDigestAuthHash());
  t.setBasicAuthPassword(credential.getBasicAuthHash());
  t.setBasicAuthSalt(credential.getBasicAuthSalt());
  // done setting the password...persist it...
  t.setIsRemoved(false);
  cc.getDatastore().putEntity(t, cc.getCurrentUser());
  // remember the current realm string
  ServerPreferencesProperties.setLastKnownRealmString(cc, currentRealmString);
  logger.warn("Reset password of the local superuser record: " + t.getUri() + " identified by: "
      + t.getUsername());
  return true;
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:35,代码来源:RegisteredUsersTable.java

示例4: getRealmInfo

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
@Override
public RealmSecurityInfo getRealmInfo(String xsrfString) throws AccessDeniedException, DatastoreFailureException {

  HttpServletRequest req = this.getThreadLocalRequest();
  CallingContext cc = ContextFactory.getCallingContext(this, req);

  if (!req.getSession().getId().equals(xsrfString)) {
    throw new AccessDeniedException("Invalid request");
  }

  RealmSecurityInfo r = new RealmSecurityInfo();
  r.setRealmString(cc.getUserService().getCurrentRealm().getRealmString());
  MessageDigestPasswordEncoder mde = (MessageDigestPasswordEncoder) cc
      .getBean(SecurityBeanDefs.BASIC_AUTH_PASSWORD_ENCODER);
  r.setBasicAuthHashEncoding(mde.getAlgorithm());
  r.setSuperUserEmail(cc.getUserService().getSuperUserEmail());
  r.setSuperUsername(cc.getUserService().getSuperUserUsername());
  try {
    r.setSuperUsernamePasswordSet(cc.getUserService().isSuperUsernamePasswordSet(cc));
  } catch (ODKDatastoreException e) {
    e.printStackTrace();
    throw new DatastoreFailureException("Unable to access datastore");
  }
  // User interface layer uses this URL to submit password changes securely
  r.setChangeUserPasswordURL(cc.getSecureServerURL() + BasicConsts.FORWARDSLASH
      + UserManagePasswordsServlet.ADDR);
  return r;
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:29,代码来源:SecurityServiceImpl.java

示例5: encodePassword

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
public static String encodePassword(String clearTextPassword) {
	return new MessageDigestPasswordEncoder("MD5", true).encodePassword(clearTextPassword, null);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:4,代码来源:UserEditForm.java

示例6: encode

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
private static String encode(String password) {
	return new MessageDigestPasswordEncoder("MD5", true).encodePassword(password, null);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:4,代码来源:PasswordChangeBackend.java

示例7: encodePasswordByMD5

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
/**
 * 采用md5进行信息摘要加密
 */
public static String encodePasswordByMD5(String password,String key){
	return new MessageDigestPasswordEncoder("MD5").encodePassword(password,key);		
}
 
开发者ID:linmuxi,项目名称:SpringSecurity,代码行数:7,代码来源:DigestUtil.java

示例8: hashPassword

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
@Override
public String hashPassword(String password) {

	return new MessageDigestPasswordEncoder(AppConstants.SHA_256.toString()).encodePassword(password, null);
}
 
开发者ID:dnbn,项目名称:submerge,代码行数:6,代码来源:UserServiceImpl.java

示例9: AbstractCoreMessageDigestPasswordEncoder

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
protected AbstractCoreMessageDigestPasswordEncoder(MessageDigestPasswordEncoder delegate) {
	this.delegate = delegate;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:4,代码来源:AbstractCoreMessageDigestPasswordEncoder.java

示例10: getPasswordEncoder

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
public MessageDigestPasswordEncoder getPasswordEncoder() {
    return passwordEncoder;
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:4,代码来源:RoleHierarchyImpl.java

示例11: setPasswordEncoder

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
public void setPasswordEncoder(MessageDigestPasswordEncoder passwordEncoder) {
    this.passwordEncoder = passwordEncoder;
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:4,代码来源:RoleHierarchyImpl.java

示例12: getHash

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
public String getHash(String id, String pass) {
	MessageDigestPasswordEncoder mdpe = new MessageDigestPasswordEncoder("MD5");
	return mdpe.encodePassword(pass, id);
}
 
开发者ID:arunkpatra,项目名称:expense-tracker,代码行数:5,代码来源:PasswordEncoder.java

示例13: getHash

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
private static String getHash(String id, String pass)
{
    MessageDigestPasswordEncoder mdpe = new MessageDigestPasswordEncoder(
            "MD5");
    return mdpe.encodePassword(pass, id);
}
 
开发者ID:arunkpatra,项目名称:expense-tracker,代码行数:7,代码来源:TestPasswordgenerator.java

示例14: setPasswordEncoder

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
public void setPasswordEncoder(MessageDigestPasswordEncoder passwordEncoder) {
	this.passwordEncoder = passwordEncoder;
}
 
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:4,代码来源:UserEditController.java

示例15: getEncodedPassword

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder; //导入依赖的package包/类
/**
 * Gets the MD5 hash and encodes it in Base 64 notation
 * 
 * @param clearTextPassword
 * @return
 * @throws NoSuchAlgorithmException
 */
public static String getEncodedPassword(String clearTextPassword) {
	return new MessageDigestPasswordEncoder("MD5", true).encodePassword(clearTextPassword, null);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:DbAuthenticateModule.java


注:本文中的org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。