Package javax.jcr

Examples of javax.jcr.Credentials


        if (callbackHandler != null) {
            log.debug("Login: retrieving Credentials using callback.");
            try {
                CredentialsCallback callback = new CredentialsCallback();
                callbackHandler.handle(new Callback[]{callback});
                Credentials creds = callback.getCredentials();
                if (creds != null && supported.contains(creds.getClass())) {
                    log.debug("Login: Credentials '{}' obtained from callback", creds);
                    return creds;
                } else {
                    log.debug("Login: No supported credentials obtained from callback; trying shared state.");
                }
            } catch (UnsupportedCallbackException e) {
                log.warn(e.getMessage());
            } catch (IOException e) {
                log.error(e.getMessage());
            }
        }

        Credentials creds = getSharedCredentials();
        if (creds != null && supported.contains(creds.getClass())) {
            log.debug("Login: Credentials obtained from shared state.");
            return creds;
        } else {
            log.debug("Login: No supported credentials found in shared state; looking for credentials in subject.");
            for (Class clz : getSupportedCredentials()) {
View Full Code Here


     * @return The credentials passed to this login module with the shared state.
     * @see #SHARED_KEY_CREDENTIALS
     */
    @CheckForNull
    protected Credentials getSharedCredentials() {
        Credentials shared = null;
        if (sharedState.containsKey(SHARED_KEY_CREDENTIALS)) {
            Object sc = sharedState.get(SHARED_KEY_CREDENTIALS);
            if (sc instanceof Credentials) {
                shared = (Credentials) sc;
            } else {
View Full Code Here

            return;
        }

        deleteMyNodes();

        Credentials cred = helper.getSuperuserCredentials();
        Session s2 = helper.getRepository().login(cred);
        root = s2.getRootNode();
        Node node2 = root.addNode("node3");
        Node n = node2.addNode("nodeWithBlob");
        ValueFactory vf = session.getValueFactory();
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public SessionInfo obtain(Credentials credentials, String workspaceName)
            throws LoginException, NoSuchWorkspaceException, RepositoryException {
        Credentials duplicate = SessionInfoImpl.duplicateCredentials(credentials);
        return new SessionInfoImpl(repository.login(credentials, workspaceName), duplicate, getNameFactory(), getPathFactory());
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public SessionInfo impersonate(SessionInfo sessionInfo, Credentials credentials) throws LoginException, RepositoryException {
        Credentials duplicate = SessionInfoImpl.duplicateCredentials(credentials);
        SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        return new SessionInfoImpl(sInfo.getSession().impersonate(credentials), duplicate, getNameFactory(), getPathFactory());
    }
View Full Code Here

    public boolean login() throws LoginException {
        if (callbackHandler != null) {
            CredentialsCallback ccb = new CredentialsCallback();
            try {
                callbackHandler.handle(new Callback[] {ccb});
                Credentials credentials = ccb.getCredentials();
                if (credentials == null) {
                    Set<Credentials> sharedCredentials;
                    Object sharedObj = sharedState.get(LoginModuleImpl.SHARED_KEY_CREDENTIALS);
                    if (sharedObj == null || !(sharedObj instanceof Set)) {
                        sharedCredentials = new HashSet<Credentials>();
View Full Code Here

        if (callbackHandler != null) {
            log.debug("Login: retrieving Credentials using callback.");
            try {
                CredentialsCallback callback = new CredentialsCallback();
                callbackHandler.handle(new Callback[]{callback});
                Credentials creds = callback.getCredentials();
                if (creds != null) {
                    log.debug("Login: Credentials '{}' obtained from callback", creds);
                    credentials.add(creds);
                }
            } catch (UnsupportedCallbackException e) {
View Full Code Here

    private String getUserID() {
        // TODO add proper implementation
        String userID = null;
        if (!credentials.isEmpty()) {
            Credentials c = credentials.iterator().next();
            if (c instanceof SimpleCredentials) {
                userID = ((SimpleCredentials) c).getUserID();
            } else if (c instanceof GuestCredentials) {
                userID = "anonymous";
            } else if (c instanceof ImpersonationCredentials) {
                Credentials bc = ((ImpersonationCredentials) c).getBaseCredentials();
                if (bc instanceof SimpleCredentials) {
                    userID = ((SimpleCredentials) bc).getUserID();
                }
            }
        }
View Full Code Here

            log.warn("Unable to perform login: initialization not completed.");
            return false;
        }

        // check for availablity of Credentials;
        Credentials creds = getCredentials();
        if (creds == null) {
            log.warn("No credentials available -> try default (anonymous) authentication.");
        }
        try {
            Principal userPrincipal = getPrincipal(creds);
View Full Code Here

     *
     * @return Credentials or null if not found
     * @see #login()
     */
    protected Credentials getCredentials() {
        Credentials credentials = null;
        if (sharedState.containsKey(KEY_CREDENTIALS)) {
            credentials = (Credentials) sharedState.get(KEY_CREDENTIALS);
        } else {
            try {
                CredentialsCallback callback = new CredentialsCallback();
                callbackHandler.handle(new Callback[]{callback});
                Credentials creds = callback.getCredentials();
                if (null != creds) {
                    if (creds instanceof SimpleCredentials) {
                       credentials = creds;
                    } else if (creds instanceof GuestCredentials) {
                       credentials = creds;
View Full Code Here

TOP

Related Classes of javax.jcr.Credentials

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.