Skip to content

Commit

Permalink
fixed code style
Browse files Browse the repository at this point in the history
  • Loading branch information
memurats committed Nov 14, 2024
1 parent 9ebabab commit 70fd265
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\IL10N;
use OCP\IRequest;
use OCP\ISession;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\IUserSession;
use Throwable;
use Psr\Container\ContainerInterface;
use OCP\Security\ISecureRandom;

// this is needed only for the special, shortened client login flow
use OCP\Security\ISecureRandom;
use OCP\ISession;
use Psr\Container\ContainerInterface;
use Throwable;

class Application extends App implements IBootstrap {
public const APP_ID = 'user_oidc';
Expand Down Expand Up @@ -80,7 +80,7 @@ public function boot(IBootContext $context): void {

try {
$context->injectFn(\Closure::fromCallable([$this, 'registerRedirect']));
$context->injectFn(\Closure::fromCallable([$this, 'registerLogin']));
$context->injectFn(\Closure::fromCallable([$this, 'registerLogin']));
// this is the custom auto-redirect for MagentaCLOUD client access
$context->injectFn(\Closure::fromCallable([$this, 'registerNmcClientFlow']));
} catch (Throwable $e) {
Expand All @@ -91,10 +91,10 @@ public function boot(IBootContext $context): void {
* This is the automatic redirect exclusively for Nextcloud/Magentacloud clients completely skipping consent layer
*/
private function registerNmcClientFlow(IRequest $request,
IURLGenerator $urlGenerator,
ProviderMapper $providerMapper,
ISession $session,
ISecureRandom $random): void {
IURLGenerator $urlGenerator,
ProviderMapper $providerMapper,
ISession $session,
ISecureRandom $random): void {
$providers = $this->getCachedProviders($providerMapper);

// Handle immediate redirect on client first-time login
Expand All @@ -109,15 +109,15 @@ private function registerNmcClientFlow(IRequest $request,
if ($isClientLoginFlow) {
// only redirect if Telekom provider registered
$tproviders = array_values(array_filter($providers, function ($p) {
return strtolower($p->getIdentifier()) === "telekom";
return strtolower($p->getIdentifier()) === 'telekom';
}));

if (count($tproviders) == 0) {
// always show normal login flow as error fallback
return;
}

$stateToken = $random->generate(64, ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS);
$stateToken = $random->generate(64, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS);
$session->set('client.flow.state.token', $stateToken);

// call the service to get the params, but suppress the template
Expand Down

0 comments on commit 70fd265

Please sign in to comment.