本文整理汇总了Java中org.pac4j.core.credentials.password.PasswordEncoder类的典型用法代码示例。如果您正苦于以下问题:Java PasswordEncoder类的具体用法?Java PasswordEncoder怎么用?Java PasswordEncoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PasswordEncoder类属于org.pac4j.core.credentials.password包,在下文中一共展示了PasswordEncoder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MongoAuthenticationHandler
import org.pac4j.core.credentials.password.PasswordEncoder; //导入依赖的package包/类
public MongoAuthenticationHandler(final String name, final ServicesManager servicesManager, final PrincipalFactory principalFactory,
final String collectionName, final String mongoHostUri, final String attributes, final String usernameAttribute,
final String passwordAttribute, final PasswordEncoder mongoPasswordEncoder) {
super(name, servicesManager, principalFactory, null);
this.collectionName = collectionName;
this.mongoHostUri = mongoHostUri;
this.attributes = attributes;
this.usernameAttribute = usernameAttribute;
this.passwordAttribute = passwordAttribute;
this.mongoPasswordEncoder = mongoPasswordEncoder;
}
示例2: start
import org.pac4j.core.credentials.password.PasswordEncoder; //导入依赖的package包/类
public void start(final int port) {
MongodStarter starter = MongodStarter.getDefaultInstance();
try {
IMongodConfig mongodConfig = new MongodConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(port, Network.localhostIsIPv6()))
.build();
mongodExecutable = starter.prepare(mongodConfig);
mongodExecutable.start();
// populate
final MongoClient mongo = new MongoClient("localhost", port);
final MongoDatabase db = mongo.getDatabase("users");
db.createCollection("users");
final MongoCollection<Document> collection = db.getCollection("users");
final PasswordEncoder encoder = new BasicSaltedSha512PasswordEncoder(SALT);
final String password = encoder.encode(PASSWORD);
Map<String, Object> properties1 = new HashMap<>();
properties1.put(USERNAME, GOOD_USERNAME);
properties1.put(PASSWORD, password);
properties1.put(FIRSTNAME, FIRSTNAME_VALUE);
collection.insertOne(new Document(properties1));
Map<String, Object> properties2 = new HashMap<>();
properties2.put(USERNAME, MULTIPLE_USERNAME);
properties2.put(PASSWORD, password);
collection.insertOne(new Document(properties2));
Map<String, Object> properties3 = new HashMap<>();
properties3.put(USERNAME, MULTIPLE_USERNAME);
properties3.put(PASSWORD, password);
collection.insertOne(new Document(properties3));
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
示例3: setup
import org.pac4j.core.credentials.password.PasswordEncoder; //导入依赖的package包/类
@Override
public void setup(Bootstrap<?> bootstrap) {
ObjectMapper om = bootstrap.getObjectMapper();
// for Config
om.addMixIn(SessionStore.class, sessionStoreMixin());
om.addMixIn(Authorizer.class, authorizerMixin());
om.addMixIn(HttpActionAdapter.class, httpActionAdapterMixin());
om.addMixIn(Matcher.class, matcherMixin());
om.addMixIn(SecurityLogic.class, securityLogicMixin());
om.addMixIn(CallbackLogic.class, callbackLogicMixin());
om.addMixIn(LogoutLogic.class, logoutLogicMixin());
// for Clients
om.addMixIn(Client.class, clientMixin());
om.addMixIn(BaseClient.class, baseClientMixin());
// for Clients and Client subsclasses
om.addMixIn(AjaxRequestResolver.class, ajaxRequestResolverMixin());
om.addMixIn(UrlResolver.class, urlResolverMixin());
om.addMixIn(AuthorizationGenerator.class,
authorizationGeneratorMixin());
// for Client/BaseClient
om.addMixIn(Authenticator.class, authenticatorMixin());
om.addMixIn(CredentialsExtractor.class, credentialExtractorMixin());
om.addMixIn(ProfileCreator.class, profileCreatorMixin());
// for IndirectClient
om.addMixIn(RedirectActionBuilder.class, redirectActionBuilderMixin());
om.addMixIn(LogoutActionBuilder.class, logoutActionBuilderMixin());
// for some of the Authenticators
om.addMixIn(PasswordEncoder.class, passwordEncoderMixin());
}
示例4: getPasswordEncoder
import org.pac4j.core.credentials.password.PasswordEncoder; //导入依赖的package包/类
public PasswordEncoder getPasswordEncoder() {
return passwordEncoder;
}
示例5: setPasswordEncoder
import org.pac4j.core.credentials.password.PasswordEncoder; //导入依赖的package包/类
public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
this.passwordEncoder = passwordEncoder;
}
示例6: MongoAuthenticator
import org.pac4j.core.credentials.password.PasswordEncoder; //导入依赖的package包/类
public MongoAuthenticator(final MongoClient mongoClient, final String attributes, final PasswordEncoder passwordEncoder) {
this.mongoClient = mongoClient;
this.attributes = attributes;
setPasswordEncoder(passwordEncoder);
}
示例7: DbAuthenticator
import org.pac4j.core.credentials.password.PasswordEncoder; //导入依赖的package包/类
public DbAuthenticator(final DataSource dataSource, final String attributes, final PasswordEncoder passwordEncoder) {
this.dataSource = dataSource;
this.attributes = attributes;
setPasswordEncoder(passwordEncoder);
}