-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ec2f6e
commit 0f15c89
Showing
4 changed files
with
690 additions
and
547 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
namespace App\Extensions\OAuth\Providers; | ||
|
||
use Filament\Forms\Components\ColorPicker; | ||
use Filament\Forms\Components\TextInput; | ||
use SocialiteProviders\Azure\Provider; | ||
|
||
|
||
|
||
final class AzureProvider extends OAuthProvider | ||
{ | ||
public function getId(): string | ||
{ | ||
return 'azure'; | ||
} | ||
|
||
public function getProviderClass(): string | ||
{ | ||
return Provider::class; | ||
} | ||
|
||
public function getServiceConfig(): array | ||
{ | ||
return [ | ||
'redirect' => env('OAUTH_AZURE_REDIRECT_URI'), | ||
'client_id' => env('OAUTH_AZURE_CLIENT_ID'), | ||
'client_secret' => env('OAUTH_AZURE_CLIENT_SECRET'), | ||
'tenant' => env('OAUTH_AZURE_TENANT_ID'), | ||
]; | ||
} | ||
public function getSettingsForm(): array | ||
{ | ||
return array_merge(parent::getSettingsForm(), [ | ||
TextInput::make('OAUTH_AZURE_REDIRECT_URI') | ||
->label('Redirect URL') | ||
->placeholder('Redirect URL') | ||
->columnSpan(2) | ||
->required() | ||
->url() | ||
->autocomplete(false) | ||
->default(env('OAUTH_AZURE_REDIRECT_URI')), | ||
TextInput::make('OAUTH_AZURE_DISPLAY_NAME') | ||
->label('Display Name') | ||
->placeholder('Display Name') | ||
->autocomplete(false) | ||
->default(env('OAUTH_AZURE_DISPLAY_NAME', 'Azure')), | ||
ColorPicker::make('OAUTH_AZURE_DISPLAY_COLOR') | ||
->label('Display Color') | ||
->placeholder('#fd4b2d') | ||
->default(env('OAUTH_AZURE_DISPLAY_COLOR', '#03c6fc')) | ||
->required() | ||
->hex(), | ||
TextInput::make("OAUTH_AZURE_TENANT_ID") | ||
->label('Tentant ID') | ||
->placeholder('Tentant ID') | ||
->columnSpan(2) | ||
->required() | ||
->password() | ||
->revealable() | ||
->autocomplete(false) | ||
->default(env("OAUTH_AZURE_TENANT_ID")), | ||
]); | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return env('OAUTH_AZURE_DISPLAY_NAME') ?? 'Azure'; | ||
} | ||
|
||
public function getIcon(): string | ||
{ | ||
return 'tabler-brand-azure'; | ||
} | ||
|
||
public function getHexColor(): string | ||
{ | ||
return env('OAUTH_AZURE_DISPLAY_COLOR') ?? '#03c6fc'; | ||
} | ||
|
||
public static function register(): self | ||
{ | ||
return new self(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.