@@ -79,7 +79,7 @@ func TestAuthCodeWithDefaultStrategy(t *testing.T) {
7979 ctx := context .Background ()
8080 reg := internal .NewMockedRegistry (t , & contextx.Default {})
8181 reg .Config ().MustSet (ctx , config .KeyAccessTokenStrategy , "opaque" )
82- reg .Config ().MustSet (ctx , config .KeyRefreshTokenHookURL , "" )
82+ reg .Config ().MustSet (ctx , config .KeyRefreshTokenHook , "" )
8383 publicTS , adminTS := testhelpers .NewOAuth2Server (ctx , t , reg )
8484
8585 publicClient := hydra .NewAPIClient (hydra .NewConfiguration ())
@@ -955,6 +955,7 @@ func TestAuthCodeWithDefaultStrategy(t *testing.T) {
955955 return func (t * testing.T ) {
956956 hs := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
957957 assert .Equal (t , r .Header .Get ("Content-Type" ), "application/json; charset=UTF-8" )
958+ assert .Equal (t , r .Header .Get ("Authorization" ), "Bearer secret value" )
958959
959960 var hookReq hydraoauth2.TokenHookRequest
960961 require .NoError (t , json .NewDecoder (r .Body ).Decode (& hookReq ))
@@ -981,9 +982,15 @@ func TestAuthCodeWithDefaultStrategy(t *testing.T) {
981982 defer hs .Close ()
982983
983984 reg .Config ().MustSet (ctx , config .KeyAccessTokenStrategy , strategy )
984- reg .Config ().MustSet (ctx , config .KeyTokenHookURL , hs .URL )
985+ reg .Config ().MustSet (ctx , config .KeyTokenHook , & config.HookConfig {
986+ URL : hs .URL ,
987+ Auth : & config.Auth {
988+ Type : "api_key" ,
989+ Config : json .RawMessage (`{"in": "header", "name": "Authorization", "value": "Bearer secret value"}` ),
990+ },
991+ })
985992
986- defer reg .Config ().MustSet (ctx , config .KeyTokenHookURL , nil )
993+ defer reg .Config ().MustSet (ctx , config .KeyTokenHook , nil )
987994
988995 expectAud := "https://api.ory.sh/"
989996 c , conf := newOAuth2Client (t , reg , testhelpers .NewCallbackURL (t , "callback" , testhelpers .HTTPServerNotImplementedHandler ))
@@ -1030,9 +1037,9 @@ func TestAuthCodeWithDefaultStrategy(t *testing.T) {
10301037 defer hs .Close ()
10311038
10321039 reg .Config ().MustSet (ctx , config .KeyAccessTokenStrategy , strategy )
1033- reg .Config ().MustSet (ctx , config .KeyTokenHookURL , hs .URL )
1040+ reg .Config ().MustSet (ctx , config .KeyTokenHook , hs .URL )
10341041
1035- defer reg .Config ().MustSet (ctx , config .KeyTokenHookURL , nil )
1042+ defer reg .Config ().MustSet (ctx , config .KeyTokenHook , nil )
10361043
10371044 expectAud := "https://api.ory.sh/"
10381045 c , conf := newOAuth2Client (t , reg , testhelpers .NewCallbackURL (t , "callback" , testhelpers .HTTPServerNotImplementedHandler ))
@@ -1070,9 +1077,9 @@ func TestAuthCodeWithDefaultStrategy(t *testing.T) {
10701077 defer hs .Close ()
10711078
10721079 reg .Config ().MustSet (ctx , config .KeyAccessTokenStrategy , strategy )
1073- reg .Config ().MustSet (ctx , config .KeyTokenHookURL , hs .URL )
1080+ reg .Config ().MustSet (ctx , config .KeyTokenHook , hs .URL )
10741081
1075- defer reg .Config ().MustSet (ctx , config .KeyTokenHookURL , nil )
1082+ defer reg .Config ().MustSet (ctx , config .KeyTokenHook , nil )
10761083
10771084 expectAud := "https://api.ory.sh/"
10781085 c , conf := newOAuth2Client (t , reg , testhelpers .NewCallbackURL (t , "callback" , testhelpers .HTTPServerNotImplementedHandler ))
@@ -1110,9 +1117,9 @@ func TestAuthCodeWithDefaultStrategy(t *testing.T) {
11101117 defer hs .Close ()
11111118
11121119 reg .Config ().MustSet (ctx , config .KeyAccessTokenStrategy , strategy )
1113- reg .Config ().MustSet (ctx , config .KeyTokenHookURL , hs .URL )
1120+ reg .Config ().MustSet (ctx , config .KeyTokenHook , hs .URL )
11141121
1115- defer reg .Config ().MustSet (ctx , config .KeyTokenHookURL , nil )
1122+ defer reg .Config ().MustSet (ctx , config .KeyTokenHook , nil )
11161123
11171124 expectAud := "https://api.ory.sh/"
11181125 c , conf := newOAuth2Client (t , reg , testhelpers .NewCallbackURL (t , "callback" , testhelpers .HTTPServerNotImplementedHandler ))
@@ -1657,11 +1664,11 @@ func TestAuthCodeWithMockStrategy(t *testing.T) {
16571664 defer hs .Close ()
16581665
16591666 if hookType == "legacy" {
1660- conf .MustSet (ctx , config .KeyRefreshTokenHookURL , hs .URL )
1661- defer conf .MustSet (ctx , config .KeyRefreshTokenHookURL , nil )
1667+ conf .MustSet (ctx , config .KeyRefreshTokenHook , hs .URL )
1668+ defer conf .MustSet (ctx , config .KeyRefreshTokenHook , nil )
16621669 } else {
1663- conf .MustSet (ctx , config .KeyTokenHookURL , hs .URL )
1664- defer conf .MustSet (ctx , config .KeyTokenHookURL , nil )
1670+ conf .MustSet (ctx , config .KeyTokenHook , hs .URL )
1671+ defer conf .MustSet (ctx , config .KeyTokenHook , nil )
16651672 }
16661673
16671674 res , err := testRefresh (t , & refreshedToken , ts .URL , false )
@@ -1699,11 +1706,11 @@ func TestAuthCodeWithMockStrategy(t *testing.T) {
16991706 defer hs .Close ()
17001707
17011708 if hookType == "legacy" {
1702- conf .MustSet (ctx , config .KeyRefreshTokenHookURL , hs .URL )
1703- defer conf .MustSet (ctx , config .KeyRefreshTokenHookURL , nil )
1709+ conf .MustSet (ctx , config .KeyRefreshTokenHook , hs .URL )
1710+ defer conf .MustSet (ctx , config .KeyRefreshTokenHook , nil )
17041711 } else {
1705- conf .MustSet (ctx , config .KeyTokenHookURL , hs .URL )
1706- defer conf .MustSet (ctx , config .KeyTokenHookURL , nil )
1712+ conf .MustSet (ctx , config .KeyTokenHook , hs .URL )
1713+ defer conf .MustSet (ctx , config .KeyTokenHook , nil )
17071714 }
17081715
17091716 origAccessTokenClaims := testhelpers .IntrospectToken (t , oauthConfig , refreshedToken .AccessToken , ts )
@@ -1734,11 +1741,11 @@ func TestAuthCodeWithMockStrategy(t *testing.T) {
17341741 defer hs .Close ()
17351742
17361743 if hookType == "legacy" {
1737- conf .MustSet (ctx , config .KeyRefreshTokenHookURL , hs .URL )
1738- defer conf .MustSet (ctx , config .KeyRefreshTokenHookURL , nil )
1744+ conf .MustSet (ctx , config .KeyRefreshTokenHook , hs .URL )
1745+ defer conf .MustSet (ctx , config .KeyRefreshTokenHook , nil )
17391746 } else {
1740- conf .MustSet (ctx , config .KeyTokenHookURL , hs .URL )
1741- defer conf .MustSet (ctx , config .KeyTokenHookURL , nil )
1747+ conf .MustSet (ctx , config .KeyTokenHook , hs .URL )
1748+ defer conf .MustSet (ctx , config .KeyTokenHook , nil )
17421749 }
17431750
17441751 res , err := testRefresh (t , & refreshedToken , ts .URL , false )
@@ -1764,11 +1771,11 @@ func TestAuthCodeWithMockStrategy(t *testing.T) {
17641771 defer hs .Close ()
17651772
17661773 if hookType == "legacy" {
1767- conf .MustSet (ctx , config .KeyRefreshTokenHookURL , hs .URL )
1768- defer conf .MustSet (ctx , config .KeyRefreshTokenHookURL , nil )
1774+ conf .MustSet (ctx , config .KeyRefreshTokenHook , hs .URL )
1775+ defer conf .MustSet (ctx , config .KeyRefreshTokenHook , nil )
17691776 } else {
1770- conf .MustSet (ctx , config .KeyTokenHookURL , hs .URL )
1771- defer conf .MustSet (ctx , config .KeyTokenHookURL , nil )
1777+ conf .MustSet (ctx , config .KeyTokenHook , hs .URL )
1778+ defer conf .MustSet (ctx , config .KeyTokenHook , nil )
17721779 }
17731780
17741781 res , err := testRefresh (t , & refreshedToken , ts .URL , false )
@@ -1794,11 +1801,11 @@ func TestAuthCodeWithMockStrategy(t *testing.T) {
17941801 defer hs .Close ()
17951802
17961803 if hookType == "legacy" {
1797- conf .MustSet (ctx , config .KeyRefreshTokenHookURL , hs .URL )
1798- defer conf .MustSet (ctx , config .KeyRefreshTokenHookURL , nil )
1804+ conf .MustSet (ctx , config .KeyRefreshTokenHook , hs .URL )
1805+ defer conf .MustSet (ctx , config .KeyRefreshTokenHook , nil )
17991806 } else {
1800- conf .MustSet (ctx , config .KeyTokenHookURL , hs .URL )
1801- defer conf .MustSet (ctx , config .KeyTokenHookURL , nil )
1807+ conf .MustSet (ctx , config .KeyTokenHook , hs .URL )
1808+ defer conf .MustSet (ctx , config .KeyTokenHook , nil )
18021809 }
18031810
18041811 res , err := testRefresh (t , & refreshedToken , ts .URL , false )
0 commit comments