Examples of OAuthRuntimeException


Examples of org.apache.amber.oauth2.common.exception.OAuthRuntimeException

            }

            return Collections.unmodifiableMap(parameters);
        } catch (JSONException e) {
            log.error("Dynamic client registration error: ", e);
            throw new OAuthRuntimeException("OAuth server error");
        }
    }
View Full Code Here

Examples of org.apache.amber.oauth2.common.exception.OAuthRuntimeException

                body = new JSONObject(jsonString);
            } catch (JSONException e) {
                log.error("Cannot decode request body as a JSON: ", e);
            } catch (Exception e) {
                log.error("Dynamic client registration error: ", e);
                throw new OAuthRuntimeException("OAuth server error");
            }
        }
    }
View Full Code Here

Examples of org.apache.oltu.oauth2.common.exception.OAuthRuntimeException

            }

            return Collections.unmodifiableMap(parameters);
        } catch (JSONException e) {
            log.error("Dynamic client registration error: ", e);
            throw new OAuthRuntimeException("OAuth server error");
        }
    }
View Full Code Here

Examples of org.apache.oltu.oauth2.common.exception.OAuthRuntimeException

                body = new JSONObject(jsonString);
            } catch (JSONException e) {
                log.error("Cannot decode request body as a JSON: ", e);
            } catch (Exception e) {
                log.error("Dynamic client registration error: ", e);
                throw new OAuthRuntimeException("OAuth server error");
            }
        }
    }
View Full Code Here

Examples of org.apache.oltu.oauth2.common.exception.OAuthRuntimeException

            final JSONTokener x = new JSONTokener(body);
            char c;
            String key;

            if (x.nextClean() != '{') {
                throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, a JSON object text must begin with '{'",
                                                       body));
            }
            for (;;) {
                c = x.nextClean();
                switch (c) {
                case 0:
                    throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, a JSON object text must end with '}'",
                                                           body));
                case '}':
                    return Collections.unmodifiableMap(parameters);
                default:
                    x.back();
                    key = x.nextValue().toString();
                }

                /*
                 * The key is followed by ':'. We will also tolerate '=' or '=>'.
                 */
                c = x.nextClean();
                if (c == '=') {
                    if (x.next() != '>') {
                        x.back();
                    }
                } else if (c != ':') {
                    throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, expected a ':' after the key '%s'",
                                                           body, key));
                }
                Object value = x.nextValue();

                // guard from null values
                if (value != null) {
                    if (value instanceof JSONArray) { // only plain simple arrays in this version
                        JSONArray array = (JSONArray) value;
                        String[] values = new String[array.length()];
                        for (int i = 0; i < array.length(); i++) {
                            values[i] = String.valueOf(array.get(i));
                        }
                        parameters.put(key, values);
                    } else {
                        parameters.put(key, new String[]{ String.valueOf(value) });
                    }
                }

                /*
                 * Pairs are separated by ','. We will also tolerate ';'.
                 */
                switch (x.nextClean()) {
                case ';':
                case ',':
                    if (x.nextClean() == '}') {
                        return Collections.unmodifiableMap(parameters);
                    }
                    x.back();
                    break;
                case '}':
                    return Collections.unmodifiableMap(parameters);
                default:
                    throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, Expected a ',' or '}",
                                                           body));
                }
            }
        }

View Full Code Here

Examples of org.apache.oltu.oauth2.common.exception.OAuthRuntimeException

            bodyRead = true;
            return OAuthUtils.saveStreamAsString(inputStream);
        } catch (Exception e) {
            log.error("Dynamic client registration error: ", e);
            throw new OAuthRuntimeException("OAuth server error");
        }
    }
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.