auth/saml/saml.go
func (s *SAMLAuthScheme) loadConfig() (BaseConfig, error) {
	if s.BaseConfig.EntityID != "" {
		return s.BaseConfig, nil
	}
	if s.Parser == nil {
		s.Parser = s
	}
	var emptyConfig BaseConfig
	publicCert, err := config.GetString("auth:saml:sp-publiccert")
	if err != nil {
		return emptyConfig, err
	}
	privateKey, err := config.GetString("auth:saml:sp-privatekey")
	if err != nil {
		return emptyConfig, err
	}
	idpURL, err := config.GetString("auth:saml:idp-ssourl")
	if err != nil {
		return emptyConfig, err
	}
	displayName, err := config.GetString("auth:saml:sp-display-name")
	if err != nil {
		displayName = "Tsuru"
		log.Debugf("auth:saml:sp-display-name not found using default: %s", err)
	}
	description, err := config.GetString("auth:saml:sp-description")
	if err != nil {
		description = "Tsuru Platform as a Service software"
		log.Debugf("auth:saml:sp-description not found using default: %s", err)
	}
	idpPublicCert, err := config.GetString("auth:saml:idp-publiccert")
	if err != nil {
		return emptyConfig, err
	}
	entityId, err := config.GetString("auth:saml:sp-entityid")
	if err != nil {
		return emptyConfig, err
	}
	signRequest, err := config.GetBool("auth:saml:sp-sign-request")
	if err != nil {
		return emptyConfig, err
	}
	signedResponse, err := config.GetBool("auth:saml:idp-sign-response")
	if err != nil {
		return emptyConfig, err
	}
	deflatEncodedResponse, err := config.GetBool("auth:saml:idp-deflate-encoding")
	if err != nil {
		deflatEncodedResponse = false
		log.Debugf("auth:saml:idp-deflate-encoding not found using default [false]: %s", err)
	}
	s.BaseConfig = BaseConfig{
		EntityID:              entityId,
		DisplayName:           displayName,
		Description:           description,
		PublicCert:            publicCert,
		PrivateKey:            privateKey,
		IdpURL:                idpURL,
		IdpPublicCert:         idpPublicCert,
		SignRequest:           signRequest,
		SignedResponse:        signedResponse,
		DeflatEncodedResponse: deflatEncodedResponse,
	}
	return s.BaseConfig, nil
}
func (s *SAMLAuthScheme) loadConfig() (BaseConfig, error) {
	if s.BaseConfig.EntityID != "" {
		return s.BaseConfig, nil
	}
	if s.Parser == nil {
		s.Parser = s
	}
	var emptyConfig BaseConfig
	publicCert, err := config.GetString("auth:saml:sp-publiccert")
	if err != nil {
		return emptyConfig, err
	}
	privateKey, err := config.GetString("auth:saml:sp-privatekey")
	if err != nil {
		return emptyConfig, err
	}
	idpURL, err := config.GetString("auth:saml:idp-ssourl")
	if err != nil {
		return emptyConfig, err
	}
	displayName, err := config.GetString("auth:saml:sp-display-name")
	if err != nil {
		displayName = "Tsuru"
		log.Debugf("auth:saml:sp-display-name not found using default: %s", err)
	}
	description, err := config.GetString("auth:saml:sp-description")
	if err != nil {
		description = "Tsuru Platform as a Service software"
		log.Debugf("auth:saml:sp-description not found using default: %s", err)
	}
	idpPublicCert, err := config.GetString("auth:saml:idp-publiccert")
	if err != nil {
		return emptyConfig, err
	}
	entityId, err := config.GetString("auth:saml:sp-entityid")
	if err != nil {
		return emptyConfig, err
	}
	signRequest, err := config.GetBool("auth:saml:sp-sign-request")
	if err != nil {
		return emptyConfig, err
	}
	signedResponse, err := config.GetBool("auth:saml:idp-sign-response")
	if err != nil {
		return emptyConfig, err
	}
	deflatEncodedResponse, err := config.GetBool("auth:saml:idp-deflate-encoding")
	if err != nil {
		deflatEncodedResponse = false
		log.Debugf("auth:saml:idp-deflate-encoding not found using default [false]: %s", err)
	}
	s.BaseConfig = BaseConfig{
		EntityID:              entityId,
		DisplayName:           displayName,
		Description:           description,
		PublicCert:            publicCert,
		PrivateKey:            privateKey,
		IdpURL:                idpURL,
		IdpPublicCert:         idpPublicCert,
		SignRequest:           signRequest,
		SignedResponse:        signedResponse,
		DeflatEncodedResponse: deflatEncodedResponse,
	}
	return s.BaseConfig, nil
}
// This method loads basic config and returns a copy of the
// config object.