Skip to content

CFM-105_Oauth2Server_MVC_review #317

Merged
merged 3 commits into from
Jul 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/plugins/CoreServer/resources/locales/en_US/core_server.po
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ msgstr "Bearer"
msgid "enumeration.HttpAuthTypeEnum.X"
msgstr "None"

msgid "enumeration.Oauth2GrandTypesEnum.AC"
msgid "enumeration.GrantTypesEnum.AC"
msgstr "Authorization Code"

msgid "enumeration.Oauth2GrandTypesEnum.CC"
msgid "enumeration.GrantTypesEnum.CC"
msgstr "Client Credentials"

msgid "enumeration.RdbmsTypeEnum.LT"
Expand Down Expand Up @@ -125,10 +125,10 @@ msgid "field.Oauth2Servers.access_grant_type"
msgstr "Access Token Grant Type"

msgid "field.Oauth2Servers.url"
msgstr "Server URL"
msgstr "Server URL"

msgid "field.Oauth2Servers.redirect_uri"
msgstr "Redirect URI"
msgstr "Redirect URI"

msgid "field.Oauth2Servers.scope"
msgstr "Scopes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

use App\Controller\StandardPluginController;
use Cake\Event\EventInterface;
use CoreServer\Lib\Enum\Oauth2GrandTypesEnum;
use CoreServer\Lib\Enum\GrantTypesEnum;

class Oauth2ServersController extends StandardPluginController
{
Expand Down Expand Up @@ -125,7 +125,7 @@ public function token($id): void

try {
switch($osrvr->access_grant_type) {
case Oauth2GrandTypesEnum::AuthorizationCode:
case GrantTypesEnum::AuthorizationCode:
// Issue a redirect to the server
$targetUrl = $osrvr->url
. '/authorize?response_type=code'
Expand All @@ -139,7 +139,7 @@ public function token($id): void

$this->redirect($targetUrl);
break;
case Oauth2GrandTypesEnum::ClientCredentials:
case GrantTypesEnum::ClientCredentials:
// Make a direct call to the server
$this->Oauth2Servers->obtainToken((int)$id, 'client_credentials');
$this->Flash->success(__d('core_server', 'info.Oauth2Servers.access_token.ok'));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* COmanage Registry Grand Types Enum
* COmanage Registry Grant Types Enum
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
Expand Down Expand Up @@ -31,7 +31,7 @@

use App\Lib\Enum\StandardEnum;

class Oauth2GrandTypesEnum extends StandardEnum
class GrantTypesEnum extends StandardEnum
{
const AuthorizationCode = 'AC';
const ClientCredentials = 'CC';
Expand Down
6 changes: 3 additions & 3 deletions app/plugins/CoreServer/src/Model/Table/Oauth2ServersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

use Cake\Routing\Router;
use Cake\Validation\Validator;
use CoreServer\Lib\Enum\Oauth2GrandTypesEnum;
use CoreServer\Lib\Enum\GrantTypesEnum;

class Oauth2ServersTable extends HttpServersTable {
use \App\Lib\Traits\PrimaryLinkTrait;
Expand Down Expand Up @@ -66,7 +66,7 @@ public function initialize(array $config): void {
$this->setAutoViewVars([
'types' => [
'type' => 'enum',
'class' => 'CoreServer.Oauth2GrandTypesEnum'
'class' => 'CoreServer.GrantTypesEnum'
]
]);

Expand Down Expand Up @@ -236,7 +236,7 @@ public function validationDefault(Validator $validator): Validator {
$validator->notEmptyString('server_id');

$validator->add('access_grant_type', [
'content' => ['rule' => ['inList', Oauth2GrandTypesEnum::getConstValues()]]
'content' => ['rule' => ['inList', GrantTypesEnum::getConstValues()]]
]);
$validator->notEmptyString('access_grant_type');

Expand Down