Should pass - https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#Terminology The OAuth 2.0 specification allows for registration of space-separated response_type parameter values. If a Response Type contains one of more space characters (%20), it is compared as a space-delimited lis
(t *testing.T)
| 25 | // If a Response Type contains one of more space characters (%20), it is compared as a space-delimited list of |
| 26 | // values in which the order of values does not matter. |
| 27 | func TestNewPushedAuthorizeRequest(t *testing.T) { |
| 28 | ctrl := gomock.NewController(t) |
| 29 | store := internal.NewMockStorage(ctrl) |
| 30 | clientManager := internal.NewMockClientManager(ctrl) |
| 31 | hasher := internal.NewMockHasher(ctrl) |
| 32 | t.Cleanup(ctrl.Finish) |
| 33 | |
| 34 | config := &Config{ |
| 35 | ScopeStrategy: ExactScopeStrategy, |
| 36 | AudienceMatchingStrategy: DefaultAudienceMatchingStrategy, |
| 37 | ClientSecretsHasher: hasher, |
| 38 | } |
| 39 | |
| 40 | fosite := &Fosite{ |
| 41 | Store: store, |
| 42 | Config: config, |
| 43 | } |
| 44 | |
| 45 | redir, _ := url.Parse("https://foo.bar/cb") |
| 46 | specialCharRedir, _ := url.Parse("web+application://callback") |
| 47 | for _, c := range []struct { |
| 48 | desc string |
| 49 | conf *Fosite |
| 50 | r *http.Request |
| 51 | query url.Values |
| 52 | expectedError error |
| 53 | mock func() |
| 54 | expect *AuthorizeRequest |
| 55 | }{ |
| 56 | /* empty request */ |
| 57 | { |
| 58 | desc: "empty request fails", |
| 59 | conf: fosite, |
| 60 | r: &http.Request{ |
| 61 | Method: "POST", |
| 62 | }, |
| 63 | expectedError: ErrInvalidClient, |
| 64 | mock: func() {}, |
| 65 | }, |
| 66 | /* invalid redirect uri */ |
| 67 | { |
| 68 | desc: "invalid redirect uri fails", |
| 69 | conf: fosite, |
| 70 | query: url.Values{"redirect_uri": []string{"invalid"}}, |
| 71 | expectedError: ErrInvalidClient, |
| 72 | mock: func() {}, |
| 73 | }, |
| 74 | /* invalid client */ |
| 75 | { |
| 76 | desc: "invalid client fails", |
| 77 | conf: fosite, |
| 78 | query: url.Values{"redirect_uri": []string{"https://foo.bar/cb"}}, |
| 79 | expectedError: ErrInvalidClient, |
| 80 | mock: func() {}, |
| 81 | }, |
| 82 | /* redirect client mismatch */ |
| 83 | { |
| 84 | desc: "client and request redirects mismatch", |
nothing calls this directly
no test coverage detected