Passed
Push — master ( bc35bf...5c2c71 )
by Roeland
09:58
created
apps/oauth2/lib/Controller/LoginRedirectorController.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -33,73 +33,73 @@
 block discarded – undo
33 33
 use OCP\IURLGenerator;
34 34
 
35 35
 class LoginRedirectorController extends Controller {
36
-	/** @var IURLGenerator */
37
-	private $urlGenerator;
38
-	/** @var ClientMapper */
39
-	private $clientMapper;
40
-	/** @var ISession */
41
-	private $session;
42
-	/** @var IL10N */
43
-	private $l;
36
+    /** @var IURLGenerator */
37
+    private $urlGenerator;
38
+    /** @var ClientMapper */
39
+    private $clientMapper;
40
+    /** @var ISession */
41
+    private $session;
42
+    /** @var IL10N */
43
+    private $l;
44 44
 
45
-	/**
46
-	 * @param string $appName
47
-	 * @param IRequest $request
48
-	 * @param IURLGenerator $urlGenerator
49
-	 * @param ClientMapper $clientMapper
50
-	 * @param ISession $session
51
-	 * @param IL10N $l
52
-	 */
53
-	public function __construct($appName,
54
-								IRequest $request,
55
-								IURLGenerator $urlGenerator,
56
-								ClientMapper $clientMapper,
57
-								ISession $session,
58
-								IL10N $l) {
59
-		parent::__construct($appName, $request);
60
-		$this->urlGenerator = $urlGenerator;
61
-		$this->clientMapper = $clientMapper;
62
-		$this->session = $session;
63
-		$this->l = $l;
64
-	}
45
+    /**
46
+     * @param string $appName
47
+     * @param IRequest $request
48
+     * @param IURLGenerator $urlGenerator
49
+     * @param ClientMapper $clientMapper
50
+     * @param ISession $session
51
+     * @param IL10N $l
52
+     */
53
+    public function __construct($appName,
54
+                                IRequest $request,
55
+                                IURLGenerator $urlGenerator,
56
+                                ClientMapper $clientMapper,
57
+                                ISession $session,
58
+                                IL10N $l) {
59
+        parent::__construct($appName, $request);
60
+        $this->urlGenerator = $urlGenerator;
61
+        $this->clientMapper = $clientMapper;
62
+        $this->session = $session;
63
+        $this->l = $l;
64
+    }
65 65
 
66
-	/**
67
-	 * @PublicPage
68
-	 * @NoCSRFRequired
69
-	 * @UseSession
70
-	 *
71
-	 * @param string $client_id
72
-	 * @param string $state
73
-	 * @param string $response_type
74
-	 * @return Response
75
-	 */
76
-	public function authorize($client_id,
77
-							  $state,
78
-							  $response_type) {
79
-		try {
80
-			$client = $this->clientMapper->getByIdentifier($client_id);
81
-		} catch (ClientNotFoundException $e) {
82
-			$response = new TemplateResponse('core', '404', 'guest');
83
-			$response->setParams([
84
-				'content' => $this->l->t('Your client is not authorized to connect. Please inform the administrator of your client.'),
85
-			]);
86
-			return $response;
87
-		}
66
+    /**
67
+     * @PublicPage
68
+     * @NoCSRFRequired
69
+     * @UseSession
70
+     *
71
+     * @param string $client_id
72
+     * @param string $state
73
+     * @param string $response_type
74
+     * @return Response
75
+     */
76
+    public function authorize($client_id,
77
+                                $state,
78
+                                $response_type) {
79
+        try {
80
+            $client = $this->clientMapper->getByIdentifier($client_id);
81
+        } catch (ClientNotFoundException $e) {
82
+            $response = new TemplateResponse('core', '404', 'guest');
83
+            $response->setParams([
84
+                'content' => $this->l->t('Your client is not authorized to connect. Please inform the administrator of your client.'),
85
+            ]);
86
+            return $response;
87
+        }
88 88
 
89
-		if ($response_type !== 'code') {
90
-			//Fail
91
-			$url = $client->getRedirectUri() . '?error=unsupported_response_type&state=' . $state;
92
-			return new RedirectResponse($url);
93
-		}
89
+        if ($response_type !== 'code') {
90
+            //Fail
91
+            $url = $client->getRedirectUri() . '?error=unsupported_response_type&state=' . $state;
92
+            return new RedirectResponse($url);
93
+        }
94 94
 
95
-		$this->session->set('oauth.state', $state);
95
+        $this->session->set('oauth.state', $state);
96 96
 
97
-		$targetUrl = $this->urlGenerator->linkToRouteAbsolute(
98
-			'core.ClientFlowLogin.showAuthPickerPage',
99
-			[
100
-				'clientIdentifier' => $client->getClientIdentifier(),
101
-			]
102
-		);
103
-		return new RedirectResponse($targetUrl);
104
-	}
97
+        $targetUrl = $this->urlGenerator->linkToRouteAbsolute(
98
+            'core.ClientFlowLogin.showAuthPickerPage',
99
+            [
100
+                'clientIdentifier' => $client->getClientIdentifier(),
101
+            ]
102
+        );
103
+        return new RedirectResponse($targetUrl);
104
+    }
105 105
 }
Please login to merge, or discard this patch.