Package io.fathom.cloud.server.auth

Examples of io.fathom.cloud.server.auth.Auth


    @Inject
    IdentityService identityService;

    @Override
    protected Message run0() throws Exception {
        Auth auth = getUnscopedAuth();
        if (auth == null) {
            throw new IllegalStateException("Cannot authenticate as " + username);
        }
        log.info("Authenticated as: {}", username);
View Full Code Here


    @Inject
    AuthService authService;

    @Override
    protected void run() throws Exception {
        Auth auth = authService.authenticate(null, username, password);
        if (auth == null) {
            throw new IllegalStateException("Cannot authenticate as " + username);
        }
        log.info("Authenticated as: {}", username);

        List<Long> projectIds = authService.resolveProjectName(auth, projectName);
        Long projectId;
        if (projectIds.isEmpty()) {
            log.info("Creating project: {}", projectName);
            projectId = authService.createProject(auth, projectName);
        } else {
            throw new IllegalArgumentException("Project already exists");
        }

        auth = authService.authenticate(projectId, username, password);
        if (auth == null) {
            throw new IllegalStateException("Error authenticating to project");
        }
        log.info("Authenticated to project");

        Project project = auth.getProject();
        println("Created project: %s", project.getId());
    }
View Full Code Here

        }
        if (Strings.isNullOrEmpty(req.secret)) {
            throw new IllegalArgumentException();
        }

        Auth auth = getAuth();

        Project project = auth.getProject();
        if (project == null) {
            throw new IllegalArgumentException();
        }

        Attachments.ClientApp app = attachments.createClientApp(auth, project, req.name, req.secret);
View Full Code Here

        if (app == null) {
            log.debug("App not found {}", appId);
            throw new WebApplicationException(Status.NOT_FOUND);
        }

        Auth auth = getAuth();
        if (auth.getUser().getId() != userId) {
            throw new WebApplicationException(Status.FORBIDDEN);
        }

        attachments.setUserSecret(app, auth, payload);
View Full Code Here

        Attachments.ClientApp app = attachments.findClientAppById(appId, secret);
        if (app == null) {
            throw new WebApplicationException(Status.NOT_FOUND);
        }

        Auth auth = getAuth();
        if (auth.getUser().getId() != userId) {
            throw new WebApplicationException(Status.FORBIDDEN);
        }

        byte[] plaintext = attachments.findUserSecret(app, auth);
        if (plaintext == null) {
View Full Code Here

TOP

Related Classes of io.fathom.cloud.server.auth.Auth

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.