Search in sources :

Example 1 with FlowStates

use of edu.uiuc.ncsa.myproxy.oa4mp.oauth2.flows.FlowStates in project OA4MP by ncsa.

the class OA2TConverter method fromMap.

@Override
public V fromMap(ConversionMap<String, Object> map, V v) {
    V st = super.fromMap(map, v);
    Object refreshToken = map.get(getTCK().refreshToken());
    if (refreshToken != null) {
        if (refreshToken instanceof RefreshToken) {
            st.setRefreshToken((RefreshToken) refreshToken);
        } else {
            st.setRefreshToken(getTF2().getRefreshToken(refreshToken.toString()));
        }
    }
    st.setRefreshTokenValid(map.getBoolean(getTCK().refreshTokenValid()));
    st.setRefreshTokenLifetime(map.getLong(getTCK().expiresIn()));
    st.setCallback(map.getURI(getTCK().callbackUri()));
    st.setNonce(map.getString(getTCK().nonce()));
    if (map.get(getTCK().scopes()) != null) {
        net.sf.json.JSONArray json = (JSONArray) JSONSerializer.toJSON(map.get(getTCK().scopes()));
        Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(json);
        st.setScopes(zzz);
    }
    if (map.get(getTCK().authTime()) != null) {
        st.setAuthTime(map.getDate(getTCK().authTime));
    }
    if (map.get(getTCK().flowStates()) != null) {
        st.setFlowStates(new FlowStates((JSONObject) JSONSerializer.toJSON(map.get(getTCK().flowStates()))));
    } else {
        st.setFlowStates(new FlowStates());
    }
    return st;
}
Also used : RefreshToken(edu.uiuc.ncsa.security.delegation.token.RefreshToken) JSONObject(net.sf.json.JSONObject) JSONArray(net.sf.json.JSONArray) JSONArray(net.sf.json.JSONArray) Collection(java.util.Collection) JSONObject(net.sf.json.JSONObject) FlowStates(edu.uiuc.ncsa.myproxy.oa4mp.oauth2.flows.FlowStates)

Aggregations

FlowStates (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.flows.FlowStates)1 RefreshToken (edu.uiuc.ncsa.security.delegation.token.RefreshToken)1 Collection (java.util.Collection)1 JSONArray (net.sf.json.JSONArray)1 JSONObject (net.sf.json.JSONObject)1