Example usage for org.springframework.security.crypto.password StandardPasswordEncoder StandardPasswordEncoder

List of usage examples for org.springframework.security.crypto.password StandardPasswordEncoder StandardPasswordEncoder

Introduction

In this page you can find the example usage for org.springframework.security.crypto.password StandardPasswordEncoder StandardPasswordEncoder.

Prototype

public StandardPasswordEncoder(CharSequence secret) 

Source Link

Document

Constructs a standard password encoder with a secret value which is also included in the password hash.

Usage

From source file:com.notemyweb.config.SecurityConfig.java

@Bean
public PasswordEncoder passwordEncoder() {
    return new StandardPasswordEncoder(extraSecureKey);
}

From source file:br.com.valecard.config.SecurityConfig.java

@Bean
public PasswordEncoder passwordEncoder() {
    return new StandardPasswordEncoder(SECRET);
}

From source file:br.com.joaops.smt.configuration.SecurityConfig.java

@Bean
public PasswordEncoder passwordEncoder() {
    StandardPasswordEncoder encoder = new StandardPasswordEncoder(defaultSecret);
    return encoder;
}

From source file:org.meruvian.yama.webapi.config.SecurityConfig.java

@Bean
public PasswordEncoder passwordEncoder() {
    return new StandardPasswordEncoder("yama");
}

From source file:org.devgateway.toolkit.forms.wicket.page.user.EditUserPage.java

@Override
public SaveEditPageButton getSaveEditPageButton() {
    return new SaveEditPageButton("save", new StringResourceModel("save", EditUserPage.this, null)) {
        private static final long serialVersionUID = 5214537995514151323L;

        @Override/*from  w  ww. j a  v  a 2 s  .  com*/
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            Person saveable = editForm.getModelObject();
            StandardPasswordEncoder encoder = new StandardPasswordEncoder("");

            // encode the password
            if (saveable.getChangePass()) {
                saveable.setPassword(encoder.encode(password.getField().getModelObject()));
            } else {
                if (saveable.getPassword() == null || saveable.getPassword().compareTo("") == 0) {
                    feedbackPanel.error(new StringResourceModel("nullPassword", this, null).getString());
                    target.add(feedbackPanel);
                    return;
                }
            }

            // user just changed his password so don't force him to change
            // it again next time
            if (isChangePassPage()) {
                saveable.setChangePassword(false);
            }

            ensureDefaultDashboardIsAlsoAssignedDashboard(saveable);

            jpaRepository.save(saveable);
            if (!SecurityUtil.isCurrentUserAdmin()) {
                setResponsePage(Homepage.class);
            } else {
                setResponsePage(listPageClass);
            }
        }
    };
}