Package de.deltatree.social.web.filter.impl.security

Source Code of de.deltatree.social.web.filter.impl.security.DefaultSASFSocialAuthManager

package de.deltatree.social.web.filter.impl.security;

import java.io.InputStream;

import org.brickred.socialauth.SocialAuthConfig;
import org.brickred.socialauth.SocialAuthManager;

import de.deltatree.social.web.filter.api.security.SASFSecurityException;
import de.deltatree.social.web.filter.api.security.SASFSocialAuthManager;
import de.deltatree.social.web.filter.impl.props.SASFProperties;

public class DefaultSASFSocialAuthManager implements SASFSocialAuthManager {

  private SocialAuthConfig socialAuthConfig;

  public DefaultSASFSocialAuthManager(final SASFProperties props)
      throws SASFSecurityException {
    SocialAuthConfig config = SocialAuthConfig.getDefault();
    InputStream in = null;
    try {
      in = DefaultSASFSocialAuthManager.class.getClassLoader()
          .getResourceAsStream(props.getOauthPropertiesFileString());
      config.load(in);
      this.socialAuthConfig = config;
    } catch (Exception e) {
      throw new SASFSecurityException(e);
    }
  }

  /**
   * gets thread safe social auth manager - current solution: each call
   * produces a new instance
   */
  @Override
  public SocialAuthManager getSocialAuthManager()
      throws SASFSecurityException {
    try {
      SocialAuthManager socialAuthManager = new SocialAuthManager();
      socialAuthManager.setSocialAuthConfig(this.socialAuthConfig);
      return socialAuthManager;
    } catch (Exception e) {
      throw new SASFSecurityException(e);
    }
  }

}
TOP

Related Classes of de.deltatree.social.web.filter.impl.security.DefaultSASFSocialAuthManager

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.