Git Product home page Git Product logo

humhub-auth-oidc's Introduction

worteks/humhub-auth-oidc

This extension adds OIDC authentication support for HumHub.

Based on yii2auth-oidc

Latest Stable Version Total Downloads Monthly Downloads License

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require worteks/humhub-auth-oidc

or add

"worteks/humhub-auth-oidc": "~0.3"

to the require section of your composer.json.

Usage

Set up an OpenID Provider (OP) and configure your Yii2 app as a Relying Party (RP) on your Authentication Server.

Example application configuration:

'components' => [
  'authClientCollection' => [
    'clients' => [
      // ...
      'oidc' => [
        'class' => 'worteks\humhub\authclient\OIDC',
        'domain' => 'https://auth.example.com',
        'clientId' => 'myClientId',
        'clientSecret' => 'myClientSecret',
        'defaultTitle' => 'auth.example.com',
        'cssIcon' => 'fa fa-sign-in',
      ],
    ],
    // ...
]

Check yii2auth-oidc for details on available configuration options.

humhub-auth-oidc's People

Contributors

soisik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

t3social studver

humhub-auth-oidc's Issues

Problems with keycloak (openid-conect)

Hi!

I am currently integrating Keycloak with Humhub with you component but i recieve error 400 for response.

yii\authclient\InvalidResponseException: Request failed with code: 400, message: <html><head><title>Error</title></head><body>Bad Request</body></html> in /var/www/html/humhub/protected/vendor/yiisoft/yii2-authclient/src/BaseOAuth.php:232 Stack trace: #0 /var/www/html/humhub/protected/vendor/yiisoft/yii2-authclient/src/BaseOAuth.php(340): yii\authclient\BaseOAuth->sendRequest(Object(yii\httpclient\Request)) #1 /var/www/html/humhub/protected/vendor/worteks/yii2auth-oidc/src/OIDC.php(115): yii\authclient\BaseOAuth->api('https://login.c...', 'GET', Array, Array) #2 /var/www/html/humhub/protected/vendor/yiisoft/yii2-authclient/src/BaseClient.php(174): worteks\yii\authclient\OIDC->initUserAttributes() #3 /var/www/html/humhub/protected/humhub/modules/user/controllers/AuthController.php(107): yii\authclient\BaseClient->getUserAttributes() #4 [internal function]: humhub\modules\user\controllers\AuthController->onAuthSuccess(Object(worteks\humhub\authclient\OIDC)) #5 /var/www/html/humhub/protected/vendor/yiisoft/yii2-authclient/src/AuthAction.php(248): call_user_func(Array, Object(worteks\humhub\authclient\OIDC)) #6 /var/www/html/humhub/protected/humhub/modules/user/authclient/AuthAction.php(43): yii\authclient\AuthAction->authSuccess(Object(worteks\humhub\authclient\OIDC)) #7 /var/www/html/humhub/protected/vendor/yiisoft/yii2-authclient/src/AuthAction.php(417): humhub\modules\user\authclient\AuthAction->authSuccess(Object(worteks\humhub\authclient\OIDC)) #8 /var/www/html/humhub/protected/vendor/yiisoft/yii2-authclient/src/AuthAction.php(226): yii\authclient\AuthAction->authOAuth2(Object(worteks\humhub\authclient\OIDC), Array) #9 /var/www/html/humhub/protected/humhub/modules/user/authclient/AuthAction.php(35): yii\authclient\AuthAction->auth(Object(worteks\humhub\authclient\OIDC)) #10 /var/www/html/humhub/protected/vendor/yiisoft/yii2-authclient/src/AuthAction.php(210): humhub\modules\user\authclient\AuthAction->auth(Object(worteks\humhub\authclient\OIDC)) #11 [internal function]: yii\authclient\AuthAction->run() #12 /var/www/html/humhub/protected/vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array) #13 /var/www/html/humhub/protected/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\Action->runWithParams(Array) #14 /var/www/html/humhub/protected/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('external', Array) #15 /var/www/html/humhub/protected/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('user/auth/exter...', Array) #16 /var/www/html/humhub/protected/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(humhub\components\Request)) #17 /var/www/html/humhub/index.php(25): yii\base\Application->run() #18 {main}

Analyzing the php code shown in the exception we realize that it performs two executions of the function "return $ this-> sendRequest ()" in the file "yii2-authclient / src / BaseOAuth.php", The first execution gives state 200 but immediately performs another which results in state 400
resulting in another error that is "Headers already sent".

My common.php file has following:

            'oidc' => [
                    'class' => 'worteks\humhub\authclient\OIDC',
                    'domain' => 'https://login.domain.cl/auth/realms/master',
                    'apiBaseUrl' => '/',
                    'authUrl' => '/protocol/openid-connect/auth',
                    'tokenUrl' => '/protocol/openid-connect/token',
                    'userInfoUrl' => 'https://login.domain.cl/auth/realms/master/protocol/openid-connect/userinfo',
                    'clientId' => 'my-client-id',
                    'clientSecret' => '640886ce-5a81-4c1b-a6c9-03e275162e1b',
                    'defaultTitle' => 'Ingreso SSO',
                    'cssIcon' => 'fa fa-sign-in'
            ],

I'm using:

  • php: v7.3
  • Humhub: v1.3.19
  • Keycloak: v7
  • Reverse Proxy behind (With apache2)

Thanks and greetings in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.