Package com.streamreduce.core.model

Examples of com.streamreduce.core.model.APIAuthenticationToken


     * @resource.representation.500 returned if invalid params are provided
     */
    @POST
    public Response login() {

        APIAuthenticationToken apiToken;
        try {
            apiToken = applicationManager.getSecurityService().issueAuthenticationToken(applicationManager.getSecurityService().getCurrentUser());
        } catch (UserNotFoundException e) {
            return error(e.getMessage(), Response.status(Response.Status.NOT_FOUND));
        } catch (ValidationException e) {
            return error(e.getMessage(), Response.status(Response.Status.BAD_REQUEST));
        }

        // return the token as a custom header value
        return Response.ok()
                .header(Constants.NODEABLE_AUTH_TOKEN, apiToken.getToken())
                .status(Response.Status.NO_CONTENT)
                .build();
    }
View Full Code Here


    }


    @Override
    public APIAuthenticationToken issueAuthenticationToken(User user) throws ValidationException, UserNotFoundException {
        APIAuthenticationToken newToken = new APIAuthenticationToken();
        user.setAuthenticationToken(newToken);
        userDAO.save(user);
        return newToken;
    }
View Full Code Here

        return null;
    }

    public User findByAuthToken(String authenticationToken) {
        Assert.hasText(authenticationToken);
        APIAuthenticationToken authToken = new APIAuthenticationToken(authenticationToken);

        return ds.createQuery(entityClazz)
                .field("authenticationToken").equal(authToken)
                .get();
    }
View Full Code Here

TOP

Related Classes of com.streamreduce.core.model.APIAuthenticationToken

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.