(state: &mut State<'_>)
| 49 | } |
| 50 | |
| 51 | fn parse_auth_fields(state: &mut State<'_>) -> Result<AuthFields, VmError> { |
| 52 | if let Value::Instance(receiver) = state.peek(0) { |
| 53 | let fields = &receiver.borrow().fields; |
| 54 | let client_id = fields |
| 55 | .get(&state.intern_static("client_id")) |
| 56 | .unwrap() |
| 57 | .as_string() |
| 58 | .unwrap() |
| 59 | .to_string(); |
| 60 | let client_secret = fields |
| 61 | .get(&state.intern_static("client_secret")) |
| 62 | .unwrap() |
| 63 | .as_string() |
| 64 | .unwrap() |
| 65 | .to_string(); |
| 66 | let auth_endpoint = fields |
| 67 | .get(&state.intern_static("auth_endpoint")) |
| 68 | .unwrap() |
| 69 | .as_string() |
| 70 | .unwrap() |
| 71 | .to_string(); |
| 72 | let token_endpoint = fields |
| 73 | .get(&state.intern_static("token_endpoint")) |
| 74 | .unwrap() |
| 75 | .as_string() |
| 76 | .unwrap() |
| 77 | .to_string(); |
| 78 | let userinfo_endpoint = fields |
| 79 | .get(&state.intern_static("userinfo_endpoint")) |
| 80 | .unwrap() |
| 81 | .as_string() |
| 82 | .unwrap() |
| 83 | .to_string(); |
| 84 | let redirect_url = fields |
| 85 | .get(&state.intern_static("redirect_url")) |
| 86 | .unwrap() |
| 87 | .as_string() |
| 88 | .unwrap() |
| 89 | .to_string(); |
| 90 | let scopes = fields |
| 91 | .get(&state.intern_static("scopes")) |
| 92 | .unwrap() |
| 93 | .as_array() |
| 94 | .unwrap() |
| 95 | .borrow() |
| 96 | .data |
| 97 | .iter() |
| 98 | .map(|scope| Scope::new(scope.as_string().unwrap().to_string())) |
| 99 | .collect::<Vec<_>>(); |
| 100 | |
| 101 | Ok(AuthFields { |
| 102 | client_id, |
| 103 | client_secret, |
| 104 | auth_endpoint, |
| 105 | token_endpoint, |
| 106 | userinfo_endpoint, |
| 107 | redirect_url, |
| 108 | scopes, |
no test coverage detected