Skip to content
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

Remove api_audience settings field #422

Merged
merged 1 commit into from
Apr 5, 2018
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
6 changes: 1 addition & 5 deletions lib/WP_Auth0_Api_Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,8 @@ public static function get_connect_info( $opt = '' ) {
'client_secret_encoded' => $a0_options->get( 'client_secret_b64_encoded' ),
'connection' => $a0_options->get( 'db_connection_name' ),
'app_token' => $a0_options->get( 'auth0_app_token' ),
'audience' => $a0_options->get( 'api_audience' ),
'audience' => self::get_endpoint( 'api/v2/' ),
);

if ( empty( self::$connect_info[ 'audience' ] ) ) {
self::$connect_info[ 'audience' ] = self::get_endpoint( 'api/v2/' );
}
}

if ( empty( $opt ) ) {
Expand Down
4 changes: 0 additions & 4 deletions lib/WP_Auth0_DBManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,6 @@ public function install_db( $version_to_install = null, $app_token = '' ) {
$options->set( 'auth0js-cdn', '//cdn.auth0.com/js/auth0/9.1/auth0.min.js' );
}

// Add API audience

$options->set( 'api_audience', 'https://' . $options->get( 'domain' ) . '/api/v2/' );

// Update app type and client grant

$client_grant_created = FALSE;
Expand Down
20 changes: 0 additions & 20 deletions lib/admin/WP_Auth0_Admin_Basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function init() {
array( 'id' => 'wpa0_client_signing_algorithm', 'name' => 'Client Signing Algorithm', 'function' => 'render_client_signing_algorithm' ),
array( 'id' => 'wpa0_cache_expiration', 'name' => 'Cache Time (minutes)', 'function' => 'render_cache_expiration' ),
array( 'id' => 'wpa0_auth0_app_token', 'name' => 'API token', 'function' => 'render_auth0_app_token' ),
array( 'id' => 'wpa0_api_audience', 'name' => 'API Identifier (audience)', 'function' => 'render_api_audience' ),
array( 'id' => 'wpa0_login_enabled', 'name' => 'WordPress login enabled', 'function' => 'render_allow_wordpress_login' ),
array( 'id' => 'wpa0_allow_signup', 'name' => 'Allow signup', 'function' => 'render_allow_signup' ),

Expand Down Expand Up @@ -81,18 +80,6 @@ public function render_auth0_app_token() {
<?php
}

public function render_api_audience() {
$v = $this->options->get( 'api_audience' );
?>
<input type="text" name="<?php
echo $this->options->get_options_name(); ?>[api_audience]" id="wpa0_api_audience" value="<?php
echo esc_attr( $v ); ?>"/>
<div class="subelement">
<span class="description"><?php _e( 'API Identifier for the management API. ', 'wp-auth0' ); ?></span>
</div>
<?php
}

public function render_client_secret() {
$v = $this->options->get( 'client_secret' );
?>
Expand Down Expand Up @@ -277,13 +264,6 @@ public function basic_validation( $old_options, $input ) {
? $input['auth0_app_token']
: $old_options['auth0_app_token'] );

if ( ! empty( $input['domain'] ) ) {

$input['api_audience'] = ( ! empty( $input['api_audience'] )
? $input['api_audience']
: 'https://' . $input['domain'] . '/api/v2/' );
}

// If we have an app token, get and store the audience
if ( ! empty( $input['auth0_app_token'] ) ) {
$db_manager = new WP_Auth0_DBManager( WP_Auth0_Options::Instance() );
Expand Down