Package io.fathom.cloud.server.auth

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


    @Inject
    NetworkService networkService;

    @Override
    public void run() throws CloudException, IOException {
        Auth unscoped = authService.authenticate(null, username, password);
        if (unscoped == null) {
            throw new IllegalArgumentException("Cannot authenticate");
        }
        List<Long> projectIds = authService.resolveProjectName(unscoped, project);

        if (projectIds.size() == 0) {
            throw new IllegalArgumentException("Cannot find project");
        }
        if (projectIds.size() != 1) {
            throw new IllegalArgumentException("The project name is ambiguous");
        }
        Long projectId = projectIds.get(0);

        Auth auth = authService.authenticate(projectId, username, password);
        if (auth == null) {
            throw new IllegalArgumentException("Cannot authenticate to project");
        }

        NetworkData.Builder b = NetworkData.newBuilder();
View Full Code Here


        }
        return r;
    }

    private ServerList listServers(boolean details) throws CloudException {
        Auth auth = getAuth();

        boolean allTenants = httpRequest.getParameter("all_tenants") != null;

        Project filterProject = getProject();
        if (allTenants) {
View Full Code Here

    private static final Logger log = LoggerFactory.getLogger(ImageResourceBase.class);

    private Project project;

    protected Project getProject() throws CloudException {
        Auth auth = null;
        if (project == null) {
            auth = findAuth();
            if (auth != null) {
                project = auth.getProject();
            }
        }
        if (project == null) {
            log.debug("No project found for auth: {}", auth);
            log.debug("X-Auth-Token: {}", httpRequest.getHeader("X-Auth-Token"));
View Full Code Here

        }
        return auth.orNull();
    }

    public boolean isAuthenticated() {
        Auth auth = findAuth();
        if (auth == null) {
            return false;
        }
        assert auth.getUser() != null;
        return true;
    }
View Full Code Here

        assert auth.getUser() != null;
        return true;
    }

    protected Project findProject(long projectId) throws CloudException {
        Auth auth = findAuth();
        if (auth == null) {
            return null;
        }

        if (!auth.checkProject(projectId)) {
            return null;
        }

        Project project = new Project(projectId);
        return project;
View Full Code Here

        }
        return baseUrl;
    }

    protected Auth getAuth() {
        Auth auth = authProvider.get();
        if (auth == null) {
            throw new WebApplicationException(Status.UNAUTHORIZED);
        }
        return auth;
    }
View Full Code Here

        return p;
    }

    protected TokenInfo findTokenInfo() throws CloudException {
        Auth auth = findAuth();
        if (auth == null) {
            return null;
        }

        if (auth instanceof TokenAuth) {
View Full Code Here

    private UserData user = null;

    protected UserData getUser() throws CloudException {
        if (this.user == null) {
            Auth auth = getAuth();
            User user = null;
            if (auth != null) {
                user = auth.getUser();
            }
            if (user == null) {
                throw new WebApplicationException(Status.UNAUTHORIZED);
            }
View Full Code Here

    // }
    // return domain;
    // }

    protected Auth.Domain findDomainWithAdminRole() {
        Auth auth = findAuth();
        if (auth == null) {
            return null;
        }
        return auth.findDomainWithAdminRole();
    }
View Full Code Here

        doProjectGrant();
        return null;
    }

    private void doProjectGrant() throws CloudException {
        Auth auth = getAuth();

        Project project = auth.getProject();

        AuthenticatedUser authenticatedUser = ((AuthServiceImpl) authService).toAuthenticatedUser(auth);
        AuthenticatedProject authenticatedProject = identityService.authenticateToProject(authenticatedUser,
                project.getId());
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.