-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuth integration #1
Conversation
# Conflicts: # test.sh
Push logs about failed builds to a repository and leverage caching on Travis
…dule into testing
…dule into theme-fix
…dule into testing
This reverts commit e680439.
- Expose our configurations that contains translatable strings for the Configuration translation module. - Use label instead of string in schema.yml where it is needed. - Use mail in appreciate places in schema.yml as type. - Deprecate entity_labels.yml, because that way it becomes easier to translate one entity related configuration objects in one place. - Do not redirect user to the Connection error page if unable to retrieve API product list on the app settings form.
available or incorrect default value is set for a field. In testing profile only the plain text filter is available and since we got rid of the restriced_html as default input format for out for elements some Format selector form elements are not visible anymore.
Internationalization improvements, part 1
Improvements from Sprint 8 and 9
…gee-drupal-module into timezone-issues
Do we need to put this in a beta branch in case issues need to be fixed in alpha? |
@cnovak No, we should not wait with this until the first beta. We should not just add fixes to the next alphas. We should introduce new features (that should be available in the first stable) in the next alpa releases to be able to get feedbacks about them. We should not introduce new features in betas because we have to guarantee backward compatibility after the first beta has released.
The OAuth integration is a typical example of a feature that may introduce some changes in the module's API, but this is fine because we do not need to worry about BC in alphas. We should release new alphas regularly, probably after each sprint until we have not covered all user stories that should be available in the first stable release. |
src/Form/AuthenticationForm.php
Outdated
|
||
// Display warning message whether there is no available key. | ||
if (empty($basic_auth_keys) && (empty($oauth_keys) || empty($oauth_token_keys))) { | ||
$this->messenger->addWarning(t('There is no available key for connecting to Apigee Edge server. <a href=":link">Create a new key.</a>', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use $this->t()
instead.
src/Form/AuthenticationForm.php
Outdated
$form['authentication']['key_oauth'] = [ | ||
'#type' => 'item', | ||
'#title' => $title, | ||
'#description' => $this->t('Select a basic authentication key or <a href=":link">' . $description_link . '</a>.', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add the $description_link
by using a placeholder too.
src/Form/AuthenticationForm.php
Outdated
} | ||
else { | ||
$title = $this->t('There is no available OAuth (SAML) token key for connecting to Apigee Edge.'); | ||
$description_link = $this->t('create a new OAuth (SAML) token key'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd call this variables as $description_link_text
.
src/OauthTokenStorage.php
Outdated
|
||
$this->key = $key; | ||
$this->keyType = $key->getKeyType(); | ||
$this->leeway = $leeway; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the value of the leeway could not come elsewhere it should come from the OAuth key storage I think.
(It is not necessary to be fixed now just leave a TODO comment here, remove it from the constructor and set its default value to 30s.)
src/OauthTokenStorage.php
Outdated
$this->key->save(); | ||
} | ||
catch (EntityStorageException $exception) { | ||
throw new OauthAuthenticationException('Could not save the OAuth response.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/OAuth response/OAuth token data/g
} | ||
|
||
if (!empty($missing_env_variables)) { | ||
$form_state->setError($form, t('The following environment variables are not set: @missing_env_variables.', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->t()
src/Plugin/KeyType/OauthKeyType.php
Outdated
use Http\Message\Authentication; | ||
|
||
/** | ||
* Key type for Apigee Edge basic authentication credentials. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/basic/Oauth/g
src/Plugin/KeyType/OauthKeyType.php
Outdated
/** | ||
* Key type for Apigee Edge basic authentication credentials. | ||
* | ||
* @KeyType( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you subclass this KeyType
annotation class as EdgeKeyType
, where could set some default settings for our keys like
- group => "apigee_edge"
- multivalue=>TRUE
- origanization, endpoint, username are required", etc
and use @EdgeKeyType
in the annotation block? That way you would not need to repeat yourself here.
@@ -86,7 +102,7 @@ public function validateKeyValue(array $form, FormStateInterface $form_state, $k | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function getAuthenticationMethod(KeyInterface $key) : Authentication { | |||
public function getAuthenticationMethod(KeyInterface $key, KeyInterface $key_token = NULL) : Authentication { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Key token interface is not needed here, can't you introduce a new optional parameter just in OauthKeyType class's getAuthenticationMethod()
in the end of the original parameter list (function getAuthenticationMethod(KeyInterface $key) : Authentication {}
).
src/SDKConnector.php
Outdated
* @param \Drupal\key\KeyInterface|null $key_token | ||
* The OAuth token key entity. | ||
* | ||
* @return CredentialsInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use FQCN.
Created module skeleton and the authentication form class.
Kernel tests for entity controller caches.
No description provided.