juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Bognar <jamesbog...@apache.org>
Subject Re: Outreachy Internship
Date Fri, 18 Oct 2019 23:34:14 GMT
Hi Ishita,

The design is pretty much up to you.  Feel free to change it to suite
your needs.  The API as it exists right now is a GET request defined
by the PetStore.login() method:

@RemoteMethod(method=GET, path="/user/login")
public Ok login(
   @Query(
      name="username",
      description="The username for login.",
      required=true,
      example="myuser"
   )
   String username,
   @Query(
      name="password",
      description="The password for login in clear text.",
      required=true,
      example="abc123"
   )
   String password,
   @ResponseHeader(
      name="X-Rate-Limit",
      type="integer",
      format="int32",
      description="Calls per hour allowed by the user.",
      example="123"
   )
   Value<Integer> rateLimit,
   Value<ExpiresAfter> expiresAfter
) throws InvalidLogin, NotAcceptable;

So it's just a GET /petstore/user/login?username=myuser&password=abc123

You'll probably implement a login form page containing something like
the following:
<form action='/user/login' method='get'>
   <input type='text' name='username'>
   <input type='text' name='password'>
</form>

The user data is persisted in the database.  We've already got a
UserRepository.findByUsername() method that can be used to look up
usernames to validate passwords with.  The role assigned to a user is
then used to control access to the PetStoreResource.createPet() method
via the @RestMethod(roleGuard) annotation (which is currently
commented out).


On Fri, Oct 18, 2019 at 2:56 PM Ishita Singh <ishitasingh1234@gmail.com> wrote:
>
> Also how are we storing user data?
>
> On Sat, Oct 19, 2019 at 12:03 AM Ishita Singh <ishitasingh1234@gmail.com> wrote:
>>
>> Hi,
>> I was working on adding a login/logout page to the petstore app. As you have specified
I'll use spring security to permit only users with role ADMIN to make changes to the pet repository.
>>
>> But I have some doubts understanding the petstore app completely.
>> Do we send the POST request from inside the petstore app. I mean once the user logs
in, how will he send the POST request.
>>
>> Thanks.

Mime
View raw message