@@ -32,34 +32,34 @@ def call(context)
3232 private
3333
3434 def resolve_auth ( context , auth_options )
35- failures = [ ]
3635 raise 'No auth options were resolved' if auth_options . empty?
3736
37+ failures = [ ]
3838 auth_options . each do |auth_option |
3939 scheme_id = auth_option [ :scheme_id ]
40+
4041 # Anonymous auth does not have a plugin and does not sign
4142 return auth_option if scheme_id == 'smithy.api#noAuth'
4243
43- unless context . config . auth_schemes . key? ( scheme_id )
44- failures << "Auth scheme #{ scheme_id } was not enabled for this request"
45- next
46- end
44+ error = validate_auth_scheme ( context , scheme_id )
45+ return auth_option unless error
4746
48- identity_provider = context . config . auth_schemes [ scheme_id ]
49- unless identity_provider
50- failures << "Auth scheme #{ scheme_id } did not have an identity provider configured"
51- next
52- end
47+ failures << error
48+ end
5349
54- unless identity_provider . identity
55- failures << "Auth scheme #{ scheme_id } failed to resolve identity"
56- next
57- end
50+ raise failures . join ( "\n " )
51+ end
5852
59- return auth_option
53+ def validate_auth_scheme ( context , scheme_id )
54+ unless context . config . auth_schemes . key? ( scheme_id )
55+ return "Auth scheme #{ scheme_id } was not enabled for this request"
6056 end
6157
62- raise failures . join ( "\n " )
58+ identity_provider = context . config . auth_schemes [ scheme_id ]
59+ return "Auth scheme #{ scheme_id } did not have an identity provider configured" unless identity_provider
60+ return "Auth scheme #{ scheme_id } failed to resolve identity" unless identity_provider . set?
61+
62+ nil
6363 end
6464 end
6565
0 commit comments