Search in sources :

Example 1 with SerializationKeys

use of edu.uiuc.ncsa.security.storage.data.SerializationKeys in project OA4MP by ncsa.

the class SATFactory method getSubject.

public static BaseClient getSubject(JSONObject json) {
    JSONObject api = json.getJSONObject(KEYS_API);
    JSONObject subject = api.getJSONObject(KEYS_SUBJECT);
    if (subject.containsKey(SUBJECT_ADMIN)) {
        return getACConverter().fromJSON(subject);
    }
    if (subject.containsKey(SUBJECT_CLIENT)) {
        JSONObject j2 = subject.getJSONObject(SUBJECT_CLIENT);
        SerializationKeys k1 = getClientConverter().getKeys();
        String secretKey = ((ClientKeys) k1).secret();
        if (j2.containsKey(CLIENT_SECRET_KEY)) {
            j2.put(secretKey, j2.getString(CLIENT_SECRET_KEY));
            j2.remove(CLIENT_SECRET_KEY);
        }
        return getClientConverter().fromJSON(subject);
    }
    return null;
}
Also used : JSONObject(net.sf.json.JSONObject) SerializationKeys(edu.uiuc.ncsa.security.storage.data.SerializationKeys) ClientKeys(edu.uiuc.ncsa.security.delegation.storage.ClientKeys)

Aggregations

ClientKeys (edu.uiuc.ncsa.security.delegation.storage.ClientKeys)1 SerializationKeys (edu.uiuc.ncsa.security.storage.data.SerializationKeys)1 JSONObject (net.sf.json.JSONObject)1