stcarrez / ada-servlet

Ada Servlet - Web Servlet Library following JSR 154, JSR 315
Apache License 2.0
7 stars 1 forks source link

copy paste error? #15

Open bjorn-lundin opened 1 week ago

bjorn-lundin commented 1 week ago

Poking around a bit in Servlet.Security.Oauth.Do_Post I see this

overriding
   procedure Do_Post (Server   : in Token_Servlet;
                      Request  : in out Servlet.Requests.Request'Class;
                      Response : in out Servlet.Responses.Response'Class) is
      type Auth_Params is new Auth.Parameters with record
         Client_Id         : Ada.Strings.Unbounded.Unbounded_String;
         Client_Secret     : Ada.Strings.Unbounded.Unbounded_String;
         Has_Authorization : Boolean := False;
      end record;
   begin
      if Pos > 0 then
         Params.Client_Id := To_Unbounded_String (Auth (Auth'First .. Pos - 1));
         Params.Client_Id := To_Unbounded_String (Auth (Pos + 1 .. Auth'Last));
         Params.Has_Authorization := True;
      end if;
      Streams.JSON.Initialize (Stream, Output);
      Response.Set_Content_Type ("application/json; charset=utf-8");
      Server.Manager.Token (Params, Grant);

I wonder if the lines Params.Client_Id := To_Unbounded_String (Auth (Auth'First .. Pos - 1)); Params.Client_Id := To_Unbounded_String (Auth (Pos + 1 .. Auth'Last)); are correct

the last might be Params.Client_Secret

stcarrez commented 1 week ago

Yes, it should be Client_Secret.