001// Generated by delombok at Mon Oct 03 07:09:45 BST 2022 002/* 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, 014 * software distributed under the License is distributed on an 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 * KIND, either express or implied. See the License for the 017 * specific language governing permissions and limitations 018 * under the License. 019 */ 020package org.apache.isis.extensions.secman.encryption.spring; 021 022import java.util.Map; 023import org.springframework.beans.factory.annotation.Qualifier; 024import org.springframework.context.annotation.Bean; 025import org.springframework.context.annotation.Configuration; 026import org.springframework.context.annotation.Import; 027import org.springframework.core.Ordered; 028import org.springframework.core.annotation.Order; 029import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 030import org.springframework.security.crypto.password.DelegatingPasswordEncoder; 031import org.springframework.security.crypto.password.PasswordEncoder; 032import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder; 033 034/** 035 * @since 2.0 {@index} 036 */ 037@Configuration 038@Import({}) 039public class IsisModuleExtSecmanEncryptionSpring { 040 /** 041 * @see "https://www.baeldung.com/spring-security-5-default-password-encoder" 042 */ 043 @Bean 044 @Qualifier("secman") 045 @Order(Ordered.LOWEST_PRECEDENCE) 046 public PasswordEncoder passwordEncoder() { 047 // set up the list of supported encoders and their prefixes 048 final java.util.Map<java.lang.String, org.springframework.security.crypto.password.PasswordEncoder> encoders = Map.<String, PasswordEncoder>of("bcrypt", new BCryptPasswordEncoder(), "scrypt", new SCryptPasswordEncoder()); 049 return new DelegatingPasswordEncoder("bcrypt", encoders); 050 } 051}