Skip to content

Commit

Permalink
Merge pull request #28 from cnovak/oauth-textchange-1
Browse files Browse the repository at this point in the history
Removing "SAML" suffix of OAuth string
  • Loading branch information
mxr576 authored Jun 19, 2018
2 parents 555501c + 788d632 commit 9ead668
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/Form/AuthenticationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#title' => $this->t('Apigee Edge API authentication type'),
'#options' => [
'apigee_edge_basic_auth' => $this->t('Basic authentication'),
'apigee_edge_oauth' => $this->t('OAuth (SAML)'),
'apigee_edge_oauth' => $this->t('OAuth'),
],
'#default_value' => isset($oauth_default_value) ? 'apigee_edge_oauth' : 'apigee_edge_basic_auth',
'#required' => TRUE,
Expand All @@ -183,7 +183,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['authentication']['key_basic_auth_missing'] = [
'#type' => 'item',
'#title' => $this->t('There is no available basic authentication key for connecting to Apigee Edge.'),
'#description' => $this->t('Select an OAuth (SAML) key or <a href=":link">create a new basic authentication key</a>.', [
'#description' => $this->t('Select an OAuth key or <a href=":link">create a new basic authentication key</a>.', [
':link' => Url::fromRoute('entity.key.add_form', ['destination' => 'admin/config/apigee-edge/settings'])->toString(),
]),
'#states' => [
Expand All @@ -198,7 +198,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {

$form['authentication']['key_oauth'] = [
'#type' => 'radios',
'#title' => $this->t('OAuth (SAML) keys'),
'#title' => $this->t('OAuth keys'),
'#options' => $oauth_keys,
'#access' => !empty($oauth_keys) && !empty($oauth_token_keys),
'#default_value' => $oauth_default_value,
Expand All @@ -213,7 +213,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {

$form['authentication']['key_oauth_token'] = [
'#type' => 'radios',
'#title' => $this->t('OAuth (SAML) token keys'),
'#title' => $this->t('OAuth token keys'),
'#options' => $oauth_token_keys,
'#access' => !empty($oauth_keys) && !empty($oauth_token_keys),
'#default_value' => $oauth_token_default_value,
Expand All @@ -229,8 +229,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
if (empty($oauth_keys)) {
$form['authentication']['key_oauth_missing'] = [
'#type' => 'item',
'#title' => $this->t('There is no available OAuth (SAML) key for connecting to Apigee Edge.'),
'#description' => $this->t('Select a basic authentication key or <a href=":link">create a new OAuth (SAML) key</a>.', [
'#title' => $this->t('There is no available OAuth key for connecting to Apigee Edge.'),
'#description' => $this->t('Select a basic authentication key or <a href=":link">create a new OAuth key</a>.', [
':link' => Url::fromRoute('entity.key.add_form', ['destination' => 'admin/config/apigee-edge/settings'])->toString(),
]),
'#states' => [
Expand All @@ -246,8 +246,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
if (empty($oauth_token_keys)) {
$form['authentication']['key_oauth_token_missing'] = [
'#type' => 'item',
'#title' => $this->t('There is no available OAuth (SAML) token key for connecting to Apigee Edge.'),
'#description' => $this->t('Select a basic authentication key or <a href=":link">create a new OAuth (SAML) token key</a>.', [
'#title' => $this->t('There is no available OAuth token key for connecting to Apigee Edge.'),
'#description' => $this->t('Select a basic authentication key or <a href=":link">create a new OAuth token key</a>.', [
':link' => Url::fromRoute('entity.key.add_form', ['destination' => 'admin/config/apigee-edge/settings'])->toString(),
]),
'#states' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/KeyType/OauthKeyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* @KeyType(
* id = "apigee_edge_oauth",
* label = @Translation("Apigee Edge OAuth (SAML)"),
* label = @Translation("Apigee Edge OAuth"),
* description = @Translation("Key type to use for Apigee Edge OAuth credentials."),
* group = "apigee_edge",
* key_value = {
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/KeyType/OauthTokenKeyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* @KeyType(
* id = "apigee_edge_oauth_token",
* label = @Translation("Apigee Edge OAuth (SAML) token"),
* label = @Translation("Apigee Edge OAuth token"),
* description = @Translation("Key type to use for Apigee Edge OAuth tokens."),
* group = "apigee_edge",
* key_value = {
Expand Down
12 changes: 6 additions & 6 deletions tests/src/Functional/EdgeAuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public function testEdgeAuthentication() {
$this->drupalGet('/admin/config/apigee-edge/settings');
$this->assertSession()->pageTextContains('There is no available basic authentication key for connecting to Apigee Edge.');
$this->getSession()->getPage()->selectFieldOption('edit-key-type', 'apigee_edge_oauth');
$this->assertSession()->pageTextContains('There is no available OAuth (SAML) key for connecting to Apigee Edge.');
$this->assertSession()->pageTextContains('There is no available OAuth (SAML) token key for connecting to Apigee Edge.');
$this->assertSession()->pageTextContains('There is no available OAuth key for connecting to Apigee Edge.');
$this->assertSession()->pageTextContains('There is no available OAuth token key for connecting to Apigee Edge.');

// Add new Apigee Edge basic authentication key
// with environment variables provider.
Expand Down Expand Up @@ -144,8 +144,8 @@ public function testEdgeAuthentication() {
$this->assertSession()->pageTextContains('Test key in private file');
$this->assertSession()->pageTextContains('Wrong test key in private file');
$this->getSession()->getPage()->selectFieldOption('edit-key-type', 'apigee_edge_oauth');
$this->assertSession()->pageTextContains('There is no available OAuth (SAML) key for connecting to Apigee Edge.');
$this->assertSession()->pageTextContains('There is no available OAuth (SAML) token key for connecting to Apigee Edge.');
$this->assertSession()->pageTextContains('There is no available OAuth key for connecting to Apigee Edge.');
$this->assertSession()->pageTextContains('There is no available OAuth token key for connecting to Apigee Edge.');

// Test key stored in environment variables.
$this->drupalPostForm('/admin/config/apigee-edge/settings', [
Expand Down Expand Up @@ -323,8 +323,8 @@ public function testEdgeAuthentication() {
$this->assertEmpty($this->config('apigee_edge.client')->get('active_key_oauth_token'));
$this->assertSession()->pageTextContains('There is no available basic authentication key for connecting to Apigee Edge.');
$this->getSession()->getPage()->selectFieldOption('edit-key-type', 'apigee_edge_oauth');
$this->assertSession()->pageTextContains('There is no available OAuth (SAML) key for connecting to Apigee Edge.');
$this->assertSession()->pageTextContains('There is no available OAuth (SAML) token key for connecting to Apigee Edge.');
$this->assertSession()->pageTextContains('There is no available OAuth key for connecting to Apigee Edge.');
$this->assertSession()->pageTextContains('There is no available OAuth token key for connecting to Apigee Edge.');

// Only Apigee Edge keys are usable in SDK connector.
$this->expectExceptionMessage('Type of default_key key does not implement EdgeKeyTypeInterface.');
Expand Down

0 comments on commit 9ead668

Please sign in to comment.