Skip to content

Commit 80a9ff5

Browse files
Merge pull request #7 from rootinc/rename-config-constants
Rename Config Constants
2 parents 6b2bfca + c2ae86c commit 80a9ff5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Route::get('/login/azurecallback', '\RootInc\LaravelAzureMiddleware\Azure@azurec
1212
```
1313

1414
3. In our `App\Http\Kernel.php` add `'azure' => \RootInc\LaravelAzureMiddleware\Azure::class,` most likely to the `$routeMiddleware` array.
15-
4. In our `.env` add `TENANT_ID, CLIENT_ID, CLIENT_SECRET and RESOURCE`. We can get these values/read more here: https://portal.azure.com/
15+
4. In our `.env` add `AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET and AZURE_RESOURCE`. We can get these values/read more here: https://portal.azure.com/
1616
5. Within our app on https://portal.azure.com/ point `reply url` to the `/login/azurecallback` route with the full url (ex: http://thewebsite.com/login/azurecallback).
1717
6. Add the `azure` middleware to your route groups on any routes that needs protected by auth and enjoy :tada:
1818
7. If you need custom callbacks, see [Extended Installation](#extended-installation).

src/Azure.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public function handle($request, Closure $next)
4242
$client = new Client();
4343

4444
try {
45-
$response = $client->request('POST', $this->baseUrl . env('TENANT_ID') . $this->route . "token", [
45+
$response = $client->request('POST', $this->baseUrl . env('AZURE_TENANT_ID') . $this->route . "token", [
4646
'form_params' => [
4747
'grant_type' => 'refresh_token',
48-
'client_id' => env('CLIENT_ID'),
49-
'client_secret' => env('CLIENT_SECRET'),
48+
'client_id' => env('AZURE_CLIENT_ID'),
49+
'client_secret' => env('AZURE_CLIENT_SECRET'),
5050
'refresh_token' => $refresh_token
5151
]
5252
]);
@@ -64,7 +64,7 @@ public function handle($request, Closure $next)
6464

6565
public function azure(Request $request)
6666
{
67-
return redirect()->away( $this->baseUrl . env('TENANT_ID') . $this->route . "authorize?response_type=code&client_id=" . env('CLIENT_ID') . "&resource=" . urlencode(env('RESOURCE')) );
67+
return redirect()->away( $this->baseUrl . env('AZURE_TENANT_ID') . $this->route . "authorize?response_type=code&client_id=" . env('AZURE_CLIENT_ID') . "&resource=" . urlencode(env('AZURE_RESOURCE')) );
6868
}
6969

7070
public function azurecallback(Request $request)
@@ -74,11 +74,11 @@ public function azurecallback(Request $request)
7474
$code = $request->input('code');
7575

7676
try {
77-
$response = $client->request('POST', $this->baseUrl . env('TENANT_ID') . $this->route . "token", [
77+
$response = $client->request('POST', $this->baseUrl . env('AZURE_TENANT_ID') . $this->route . "token", [
7878
'form_params' => [
7979
'grant_type' => 'authorization_code',
80-
'client_id' => env('CLIENT_ID'),
81-
'client_secret' => env('CLIENT_SECRET'),
80+
'client_id' => env('AZURE_CLIENT_ID'),
81+
'client_secret' => env('AZURE_CLIENT_SECRET'),
8282
'code' => $code
8383
]
8484
]);

0 commit comments

Comments
 (0)