jumbojett / OpenID-Connect-PHP

Minimalist OpenID Connect client
https://github.com/jumbojett/OpenID-Connect-PHP
Apache License 2.0
602 stars 360 forks source link

require Crypt/RSA.php line missing? #142

Closed JannemanDev closed 5 years ago

JannemanDev commented 5 years ago

I am using the latest version v0.7. I didn't use composer, just copied and included the library in my project. But I had to add this line before the class_exists lines to get the library up and running:

require "Crypt/RSA.php";

if (!class_exists('\phpseclib\Crypt\RSA') && !class_exists('Crypt_RSA')) {
    user_error('Unable to find phpseclib Crypt/RSA.php.  Ensure phpseclib is installed and in include_path before you include this file');
}

I copied the phpseclib subdirectory from the src installation package into my lib folder. In my application I then use the openidconnect library as follows:

  set_include_path(get_include_path().PATH_SEPARATOR.'./lib/phpseclib'.PATH_SEPARATOR.'./lib/OpenID-Connect-PHP');

  // Include the openID client
  require "OpenIDConnectClient.php";
  use Jumbojett\OpenIDConnectClient;

  // Create a new client
  $oidc = new OpenIDConnectClient(OPENID_SERVER,FHICT_CLIENT_ID,FHICT_CLIENT_SECRET);

Is this fix an omission in your source or am I doing something wrong?

jumbojett commented 5 years ago

I didn't use composer, just copied and included the library in my project.

@JanOonk composer will pull in a the dependancies! You should definitely be using it.

JannemanDev commented 5 years ago

That I know but that still doesn't answer my question.

jumbojett commented 5 years ago

Is this fix an omission in your source or am I doing something wrong?

Apologies. I'm not sure I fully understand. Composer includes an autoloader that configures path dependencies. (Similar to what you're doing above.) Can you rephrase the question?

JannemanDev commented 5 years ago

For all people that can not use composer and just like me, in this instance, won't use composer and just follow the procedure I described. The fact that I had to insert require "Crypt/RSA.php"; is that a bug/omission in the source?

jumbojett commented 5 years ago

In the case you describe, it's an omission. Not a bug.

JannemanDev commented 5 years ago

Ok not a bug, it's more like a dependency missing. Consider it documented by this issue :)