Exception: StandardId::AmbiguousProfileError

Inherits:
InvalidGrantError show all
Defined in:
lib/standard_id/errors.rb

Overview

Raised at mint time when an account has more than one active profile of the type bound to the requested audience. Selecting one silently would be non-deterministic and unauditable, so we fail closed and let the host app resolve the ambiguity (deactivate duplicates, or pass an explicit ‘profile_id` once that grant parameter is supported).

Same audit-only/PII rules as ‘NoBoundProfileError`: do NOT surface profile_ids in client-facing responses.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from InvalidGrantError

#oauth_error_code

Methods inherited from OAuthError

#http_status, #oauth_error_code

Constructor Details

#initialize(audience:, expected_profile_types:, profile_ids:) ⇒ AmbiguousProfileError

Returns a new instance of AmbiguousProfileError.



92
93
94
95
96
97
98
# File 'lib/standard_id/errors.rb', line 92

def initialize(audience:, expected_profile_types:, profile_ids:)
  @audience = audience
  @expected_profile_types = Array(expected_profile_types)
  @profile_ids = Array(profile_ids)
  super("Multiple active profiles of type [#{@expected_profile_types.join(', ')}] " \
        "for audience '#{audience}' (#{@profile_ids.length} profile(s))")
end

Instance Attribute Details

#audienceObject (readonly)

Returns the value of attribute audience.



90
91
92
# File 'lib/standard_id/errors.rb', line 90

def audience
  @audience
end

#expected_profile_typesObject (readonly)

Returns the value of attribute expected_profile_types.



90
91
92
# File 'lib/standard_id/errors.rb', line 90

def expected_profile_types
  @expected_profile_types
end

#profile_idsObject (readonly)

Returns the value of attribute profile_ids.



90
91
92
# File 'lib/standard_id/errors.rb', line 90

def profile_ids
  @profile_ids
end