Package org.geogrid.aist.credential.services.security.gss

Examples of org.geogrid.aist.credential.services.security.gss.CredentialContext


    public void activate(User user, GSSCredential credential) throws Exception {
        log.info("Clear CredentialCotntexts");
        credentialManager.deactivateCredentialContexts(user);
        String dn = credential.getName().toString();
        CredentialContext context =
            credentialManager.getCredentialContextByDn(dn);
        if (context == null) {
            log.info("No CredentialContext found for \"" + dn + "\"");
            context = credentialManager.createCredentialContext(user, dn);
            context.setLabel("tsukuba-gama");
        } else if ( ! findContext(user, dn) ) {
            log.info("Delete old credential context oid[" + context.getOid() + "]");
            credentialManager.deleteCredentialContext(context);
            context = credentialManager.createCredentialContext(user, dn);
            context.setLabel("tsukuba-gama");
        } else {
            log.info("Activate credential");
        }
        deleteOldCredentialContext(user, dn);
        context.activate(credential);
        credentialManager.saveCredentialContext(context);
    }
View Full Code Here


        List contexts = credentialManager.getCredentialContexts(user);
        if (contexts == null) {
            return false;
        }
        for (Iterator itr = contexts.iterator(); itr.hasNext(); ) {
            CredentialContext context = (CredentialContext)itr.next();
            if (dn.equals( context.getDn() )) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        List contexts = credentialManager.getCredentialContexts(user);
        if ((contexts == null) || (contexts.isEmpty())) {
            return ;
        }
        for (Iterator itr = contexts.iterator(); itr.hasNext(); ) {
            CredentialContext context = (CredentialContext)itr.next();
            if (! dn.equals( context.getDn() )) {
                log.info("Subject DN does not match. Delete old CredentialContex t: " + context.getDn());
                credentialManager.deleteCredentialContext(context);
            }
        }
    }
View Full Code Here

            credDn = credential.getName().toString();
        } catch (GSSException e) {
            log.warn(e.getMessage());
            throw new CredentialException("Unknown error occured", e);
        }
        CredentialContext context = getCredentialContextByDn(credDn);
        if (context == null) {
            throw new CredentialException("No credentialContext context found with dn " + credDn);
        }
        context.activate(credential);
        saveCredentialContext(context);
        return context;
   }
View Full Code Here

    public List getActiveCredentialContexts(User user) {
        List userContexts = getCredentialContexts(user);
        List activeContexts = new Vector(1);
        for (Iterator contexts = userContexts.iterator(); contexts.hasNext();) {
            CredentialContext context = (CredentialContext) contexts.next();
            if (context.isActive()) {
                activeContexts.add(context);
            }
        }
        return activeContexts;
    }
View Full Code Here

    public List getActiveCredentials(User user) {
        List userContexts = getCredentialContexts(user);
        List activeCredentials = new Vector(1);
        for (Iterator contexts = userContexts.iterator(); contexts.hasNext();) {
            CredentialContext context = (CredentialContext) contexts.next();
            if (context.isActive()) {
                GSSCredential credential = context.getCredential();
                activeCredentials.add(credential);
            }
        }
        return activeCredentials;
    }
View Full Code Here

    public List getActiveCredentialFileNames(User user) {
        List activeCredentialFileNames = new Vector(1);
        if (saveCredentialsToFile) {
            List userContexts = getCredentialContexts(user);
            for (Iterator contexts = userContexts.iterator(); contexts.hasNext();) {
                CredentialContext context = (CredentialContext) contexts.next();
                if (context.isActive()) {
                    String fileName = getCredentialFileName(context.getDn());
                    if (fileName != null) {
                        activeCredentialFileNames.add(fileName);
                    }
                }
            }
View Full Code Here

        activeCredentialDir = dir;
    }

    public String getActiveCredentialFileName(String dn) {
        if (saveCredentialsToFile) {
            CredentialContext context = getCredentialContextByDn(dn);
            if (context.isActive()) {
                return getCredentialFileName(context.getDn());
            }
        }
        return null;
    }
View Full Code Here

        throws AuthenticationException {
        try {
            log.info("Clear CredentialCotntexts");
            credentialManager.deactivateCredentialContexts(user);
            String dn = credential.getName().toString();
            CredentialContext context =
                credentialManager.getCredentialContextByDn(dn);
            if (context == null) {
                log.info("No CredentialContext found for \"" + dn + "\"");
                context = credentialManager.createCredentialContext(user, dn);
                context.setLabel("tsukuba-gama");
            } else if ( ! findContextOfUser(user, dn) ) {
                log.info("Delete old credential context oid["
                    + context.getOid() + "]");
                credentialManager.deleteCredentialContext(context);
                context = credentialManager.createCredentialContext(user, dn);
                context.setLabel("tsukuba-gama");
            } else {
                log.info("Activate credential");
            }
            deleteOldCredentialContext(user, dn);
            context.activate(credential);
            credentialManager.saveCredentialContext(context);
        } catch (GSSException e) {
            throw new AuthenticationException(e.getMessage());
        } catch (CredentialException e) {
            log.error("Couldn't activate", e);
View Full Code Here

        List contexts = credentialManager.getCredentialContexts(user);
        if (contexts == null) {
            return false;
        }
        for (Iterator itr = contexts.iterator(); itr.hasNext(); ) {
            CredentialContext cont = (CredentialContext)itr.next();
            if (dn.equals( cont.getDn() )) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of org.geogrid.aist.credential.services.security.gss.CredentialContext

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.