prise en compte protocole

This commit is contained in:
afornerot 2024-02-16 13:53:54 +01:00
parent 70ea9bff97
commit 1714bd9a70
3 changed files with 3 additions and 9 deletions

1
.env
View File

@ -1,6 +1,7 @@
# Symfony
APP_ENV=PROD
APP_SECRET=changemeinenvlocal
APP_PROTOCOL=https
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'

View File

@ -6,6 +6,7 @@
parameters:
appEnv: '%env(resolve:APP_ENV)%'
appSecret: '%env(resolve:APP_SECRET)%'
appProtocol: '%env(resolve:APP_PROTOCOL)%'
appWeburl: '%env(resolve:APP_WEBURL)%'
appAuth: '%env(resolve:APP_AUTH)%'

View File

@ -135,16 +135,8 @@ class SecurityController extends AbstractController
}
public function loginOAUTH() {
/*
OAUTH_CLIENTID=
OAUTH_CLIENTSECRET=
OAUTH_LOGINURL=https://forge.cadoles.com/login/oauth/authorize
OAUTH_LOGOUTURL=https://forge.cadoles.com/user/logout
OAUTH_TOKENURL=https://forge.cadoles.com/login/oauth/access_token
*/
// https://[YOUR-GITEA-URL]/login/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI& response_type=code&state=STATE
$callback=$this->generateUrl('app_login_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL);
$callback=str_replace("http://",$this->getParameter("appProtocol")."://",$callback);
$this->get('session')->set('giteacallback', $callback);
$url=$this->getParameter("oauthLoginurl")."?client_id=".$this->getParameter("oauthClientid")."&redirect_uri=".$callback."&response_type=code&state=STATE";
return $this->redirect($url);