diff --git a/lib/SimpleSAML/Auth/AuthenticationFactory.php b/lib/SimpleSAML/Auth/AuthenticationFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..7335bc2d5643ba76e6d76c5a524ce9af444fe53c --- /dev/null +++ b/lib/SimpleSAML/Auth/AuthenticationFactory.php @@ -0,0 +1,37 @@ +<?php + +namespace SimpleSAML\Auth; + +/** + * Factory class to get instances of \SimpleSAML\Auth\Simple for a given authentication source. + */ +class AuthenticationFactory +{ + + /** @var \SimpleSAML\Configuration */ + protected $config; + + /** @var \SimpleSAML\Session */ + protected $session; + + + public function __construct(\SimpleSAML\Configuration $config, \SimpleSAML\Session $session) + { + $this->config = $config; + $this->session = $session; + } + + + /** + * Create a new instance of \SimpleSAML\Auth\Simple for the given authentication source. + * + * @param string $as The identifier of the authentication source, as indexed in the authsources.php configuration + * file. + * + * @return \SimpleSAML\Auth\Simple + */ + public function create($as) + { + return new Simple($as, $this->config, $this->session); + } +} \ No newline at end of file