Skip to content

Commit

Permalink
add a hook to modify returned attributes.
Browse files Browse the repository at this point in the history
Add a hook for modifying the returned attributes
in the SAML request.
  • Loading branch information
anthonybaxter-uwu committed Jul 15, 2024
1 parent 0715612 commit b2a8d30
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions inc/class-wp-saml-auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ function () use ( $redirect_to ) {
return new WP_Error( 'wp_saml_auth_no_attributes', esc_html__( 'No attributes were present in SAML response. Attributes are used to create and fetch users. Please contact your administrator', 'wp-saml-auth' ) );
}

// Some SAML providers return oddly shaped
// responses.
$attributes = apply_filters(
'wp_saml_auth_patch_attributes', $attributes,
$provider);

$get_user_by = self::get_option( 'get_user_by' );
$attribute = self::get_option( "user_{$get_user_by}_attribute" );
if ( empty( $attributes[ $attribute ][0] ) ) {
Expand Down

0 comments on commit b2a8d30

Please sign in to comment.