Examples of Auth


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

    @Inject
    SecurityGroups securityGroups;

    @POST
    public WrappedSecurityGroupRule createRule(WrappedSecurityGroupRule request) throws Exception {
        Auth auth = getAuth();

        SecurityGroupRule rule = request.rule;
        long securityGroupId = Long.valueOf(rule.parentGroupId);

        SecurityGroupData securityGroupData = securityGroups.find(getProject(), securityGroupId);
View Full Code Here

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

    @Produces({ JSON })
    public WrappedCertificate getCertificate(@PathParam("id") String id) throws CloudException {
        // This is entirely wrong
        warnStub();

        Auth auth = getAuth();

        User user = auth.getUser();
        if (user == null) {
            throw new WebApplicationException(Status.UNAUTHORIZED);
        }

        if (!id.equals("root")) {
View Full Code Here

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

        warnStub();

        WrappedCertificate response = new WrappedCertificate();
        response.certificate = new Certificate();

        Auth auth = getAuth();

        User user = auth.getUser();
        if (user == null) {
            throw new WebApplicationException(Status.UNAUTHORIZED);
        }

        X500Principal subject = new X500Principal("CN=" + "user-" + user.getId());
View Full Code Here

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

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

        }
        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

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

    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

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

        }
        return auth.orNull();
    }

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

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

        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

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

        }
        return baseUrl;
    }

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

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

        return p;
    }

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

        if (auth instanceof TokenAuth) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.