Example usage for org.springframework.security.authentication ProviderManager setEraseCredentialsAfterAuthentication

List of usage examples for org.springframework.security.authentication ProviderManager setEraseCredentialsAfterAuthentication

Introduction

In this page you can find the example usage for org.springframework.security.authentication ProviderManager setEraseCredentialsAfterAuthentication.

Prototype

public void setEraseCredentialsAfterAuthentication(boolean eraseSecretData) 

Source Link

Document

If set to, a resulting Authentication which implements the CredentialsContainer interface will have its CredentialsContainer#eraseCredentials() eraseCredentials method called before it is returned from the authenticate() method.

Usage

From source file:org.red5.demo.auth.Application.java

@Override
public boolean appStart(IScope app) {
    // authentication management
    ProviderManager authManager = (ProviderManager) applicationContext.getBean("authManager");
    log.info("Available auth providers: {}", authManager.getProviders().size());
    if (authManager.isEraseCredentialsAfterAuthentication()) {
        log.info("Provider set to erase creds, changing to NOT do this");
        authManager.setEraseCredentialsAfterAuthentication(false);
    }/*from   w ww.  ja va2 s  .co  m*/
    // add an authentication listener
    addListener((IApplication) applicationContext.getBean("authHandler"));
    // hit the super class
    return super.appStart(app);
}

From source file:org.red5.webapps.admin.Application.java

@Override
public boolean appStart(IScope app) {
    log.info("Admin application started");
    // authentication check
    ProviderManager authManager = (ProviderManager) applicationContext.getBean("authenticationManager");
    log.info("Available auth providers: {}", authManager.getProviders().size());
    if (authManager.isEraseCredentialsAfterAuthentication()) {
        log.info("Provider set to erase creds, changing to NOT do this");
        authManager.setEraseCredentialsAfterAuthentication(false);
    }//ww  w .  j a  v a 2  s.  c om
    // add an authentication listener
    if (enforceAuthentication) {
        addListener(new Red5AuthenticationHandler(applicationContext));
    }
    return true;
}

From source file:org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder.java

@Override
protected ProviderManager performBuild() throws Exception {
    if (!isConfigured()) {
        logger.debug("No authenticationProviders and no parentAuthenticationManager defined. Returning null.");
        return null;
    }//  w w w. j a  v a2s . c  o  m
    ProviderManager providerManager = new ProviderManager(authenticationProviders, parentAuthenticationManager);
    if (eraseCredentials != null) {
        providerManager.setEraseCredentialsAfterAuthentication(eraseCredentials);
    }
    if (eventPublisher != null) {
        providerManager.setAuthenticationEventPublisher(eventPublisher);
    }
    providerManager = postProcess(providerManager);
    return providerManager;
}