Android AuthenticationException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android AuthenticationException class.

This code example shows how to use the following methods:
                throw new InvalidCredentialsException(gsse.getMessage(), gsse);
            if (gsse.getMajor() == GSSException.DEFECTIVE_TOKEN || gsse.getMajor() == GSSException.DUPLICATE_TOKEN
                    || gsse.getMajor() == GSSException.OLD_TOKEN)
                throw new AuthenticationException(gsse.getMessage(), gsse);
            // other error 
            throw new AuthenticationException(gsse.getMessage());
        } 
    } 
 
    /** 
     * Returns the authentication parameter with the given name, if available. 
     * 
     * <p> 
     * There are no valid parameters for Negotiate authentication so this method always returns <tt>null</tt>. 
     * </p> 
     * 
     * @param name The name of the parameter to be returned 
     * 
     * @return the parameter with the given name 
     */ 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        try { 
            Server server = new Server(activity);
            boolean authenticated = server.authenticate();
            if (!authenticated) {
                Log.e(TAG, "Unable to authenticate to server");
                return new ServerResponse(new AuthenticationException());
            } 
 
            Preferences prefs = new Preferences(activity);
            return prefs.sendSettings(server);
        } catch (Exception e) {
            Log.e(TAG, "Unable to send settings: " + e.toString());
            e.printStackTrace();
            return new ServerResponse(e);
        } 
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        int HttpResult = urlConnection.getResponseCode();  
        if(HttpResult == HttpURLConnection.HTTP_OK) {
        	return urlConnection.getInputStream();
        } else {   
        	if(urlConnection.getResponseMessage().equals("Unauthorized"))
        		throw new AuthenticationException(urlConnection.getResponseMessage());
        	else 
        		throw new Exception(urlConnection.getResponseMessage());  
        } 
	} 
	 
	 
	private static HttpURLConnection getUrlConnection(URL url, Context context, String username, String password) throws IOException, KeyManagementException, NoSuchAlgorithmException {
		URLConnection urlConnection = url.openConnection();
 
		// If https is used, use MemorizingTrustManager for certificate verification 
		if (urlConnection instanceof HttpsURLConnection) {
			HttpsURLConnection httpsURLConnection = (HttpsURLConnection) urlConnection;
 
			// set location of the keystore 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
                friendList.add(User.valueOf(friends.getJSONObject(i)));
            } 
        } else { 
            if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
                Log.e(TAG, "Authentication exception in fetching remote contacts");
                throw new AuthenticationException();
            }  else if(resp.getStatusLine().getStatusCode() == HttpStatus.SC_FORBIDDEN) {
            	Log.e(TAG, "Fetching contact updates forbidden");
            	throw new FeedForbiddenException(); 
            } else { 
                Log.e(TAG, "Server error in fetching remote contacts: "
                    + resp.getStatusLine());
                throw new IOException();
            } 
        } 
        return friendList;
    } 
     
    /** 
     * Retrieves a list of bookmark updates for contacts in a users network. 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
            // base64-encode the hmac 
            return Base64.encodeBase64String(rawHmac);
 
        } catch (InvalidKeyException ex) {
            throw new AuthenticationException("Failed to generate HMAC: " + ex.getMessage(), ex);
        } catch (NoSuchAlgorithmException ex) {
            throw new AuthenticationException(HMAC_SHA1_ALGORITHM +
                    " algorithm is not supported", ex);
        } 
    } 
 
    /** 
     * Returns the canonicalized AMZ headers. 
     * 
     * @param headers 
     *            The list of request headers. 
     * @return The canonicalized AMZ headers. 
     */ 
    private static String getCanonicalizedAmzHeaders(final Header[] headers) {
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getMessage
This code example shows how to use the following methods:
 
            // base64-encode the hmac 
            return Base64.encodeBase64String(rawHmac);
 
        } catch (InvalidKeyException ex) {
            throw new AuthenticationException("Failed to generate HMAC: " + ex.getMessage(), ex);
        } catch (NoSuchAlgorithmException ex) {
            throw new AuthenticationException(HMAC_SHA1_ALGORITHM +
                    " algorithm is not supported", ex);
        } 
    } 
 
    /** 
     * Returns the canonicalized AMZ headers. 
     * 
     * @param headers 
     *            The list of request headers. 
     * @return The canonicalized AMZ headers. 
     */ 
    private static String getCanonicalizedAmzHeaders(final Header[] headers) {
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
                if (gsse.getMajor() == GSSException.NO_CRED )
                    throw new InvalidCredentialsException(gsse.getMessage(), gsse);
                if (gsse.getMajor() == GSSException.DEFECTIVE_TOKEN
                        || gsse.getMajor() == GSSException.DUPLICATE_TOKEN
                        || gsse.getMajor() == GSSException.OLD_TOKEN)
                    throw new AuthenticationException(gsse.getMessage(), gsse);
                // other error 
                throw new AuthenticationException(gsse.getMessage());
            } 
        case TOKEN_GENERATED:
            String tokenstr = new String(base64codec.encode(token));
            if (log.isDebugEnabled()) {
                log.debug("Sending response '" + tokenstr + "' back to the auth server");
            } 
            return new BasicHeader("Authorization", "Negotiate " + tokenstr);
        default: 
            throw new IllegalStateException("Illegal state: " + state);
        } 
    } 
 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
String id = authScheme.getSchemeName();
 
        Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH));
        if (challenge == null) {
            throw new AuthenticationException(id +
                " authorization challenge expected, but not found"); 
        } 
        authScheme.processChallenge(challenge);
        if (DEBUG) {
        	logger.debug("Authorization challenge processed"); 
        } 
    } 
 
 
    private void updateAuthState( 
            final AuthState authState,
            final HttpHost host,
            final CredentialsProvider credsProvider) {
 
2
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android AuthenticationException Questions & Answers:

See Code Examples for Android AuthenticationException Methods: