Package com.example.helloworld.core

Examples of com.example.helloworld.core.Token


   
    JWSSigner signer = new MACSigner(TOKEN_SECRET);
    SignedJWT jwt = new SignedJWT(JWT_HEADER, claim);
    jwt.sign(signer);
   
    return new Token(jwt.serialize());
  }
View Full Code Here


  public Response login(@Valid User user, @Context HttpServletRequest request)
      throws JOSEException {
    Optional<User> foundUser = dao.findByEmail(user.getEmail());
    if (foundUser.isPresent()
        && PasswordService.checkPassword(user.getPassword(), foundUser.get().getPassword())) {
      Token token = AuthUtils.createToken(request.getRemoteHost(), foundUser.get().getId());
      return Response.ok().entity(token).build();
    }
    return Response.status(Status.UNAUTHORIZED).entity(new ErrorMessage(LOGING_ERROR_MSG))
        .build();
  }
View Full Code Here

  @Path("signup")
  @UnitOfWork
  public Response signup(@Valid User user, @Context HttpServletRequest request) throws JOSEException {
    user.setPassword(PasswordService.hashPassword(user.getPassword()));
    User savedUser = dao.save(user);
    Token token = AuthUtils.createToken(request.getRemoteHost(), savedUser.getId());
    return Response.status(Status.CREATED).entity(token).build();
  }
View Full Code Here

        userToSave.setDisplayName(displayName);
        userToSave = dao.save(userToSave);
      }
    }

    Token token = AuthUtils.createToken(request.getRemoteHost(), userToSave.getId());
    return Response.ok().entity(token).build();
  }
View Full Code Here

TOP

Related Classes of com.example.helloworld.core.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.