Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package edu.uiuc.ncsa.myproxy.oa4mp.oauth2.loader;
  
 
 
 import static edu.uiuc.ncsa.myproxy.oa4mp.server.util.OA4MPIdentifierProvider.TRANSACTION_ID;
 import static edu.uiuc.ncsa.security.core.util.IdentifierProvider.SCHEME;
 import static edu.uiuc.ncsa.security.core.util.IdentifierProvider.SCHEME_SPECIFIC_PART;
 import static edu.uiuc.ncsa.security.oauth_2_0.OAuth2Constants.*;

Created by Jeff Gaynor
on 9/23/13 at 1:50 PM

 
 public class OA4MPConfigurationLoader2<T extends ServiceEnvironmentImplextends ServerConfigurationLoader<T> {
    
Default is 15 days. Internally the refresh lifetime (as all date-ish things) are in milliseconds though the configuration file is assumed to be in seconds.
 
     public long REFRESH_TOKEN_LIFETIME_DEFAULT = 15 * 24 * 3600 * 1000L;
 
         super(node);
     }
 
     public OA4MPConfigurationLoader2(ConfigurationNode nodeMyLoggingFacade logger) {
         super(nodelogger);
     }
 
     @Override
     public T createInstance() {
         return (T) new OA2SE(.get(),
                 getTransactionStoreProvider(),
                 getClientStoreProvider(),
                 getMaxAllowedNewClientRequests(),
                 getRTLifetime(),
                 getClientApprovalStoreProvider(),
                 getMyProxyFacadeProvider(),
                 getMailUtilProvider(),
                 getMP(),
                 getAGIProvider(),
                 getATIProvider(),
                 getPAIProvider(),
                 getTokenForgeProvider(),
                 getConstants(),
                 getAuthorizationServletConfig(),
                 getUsernameTransformer());
     }
 
 
     @Override
     public HashMap<StringStringgetConstants() {
         if ( == null) {
              = new HashMap<StringString>();
             // OAuth 1.0a callback constant. This is used to as a key for http request parameters
        }
        return ;
    }
    @Override
    public Provider<AGIssuergetAGIProvider() {
        if ( == null) {
            return new Provider<AGIssuer>() {
                @Override
                public AGIssuer get() {
                    return new AGI2(getTokenForgeProvider().get(), getServiceAddress());
                }
            };
        }
        return ;
    }
    Provider<AGIssueragip = null;
    @Override
        return getCASP();
    }
    @Override
        return getCSP();
    }
    @Override
        if ( == null) {
            final ClientApprovalProvider caProvider = new ClientApprovalProvider();
            ClientApprovalKeys caKeys = new ClientApprovalKeys();
            caKeys.identifier("client_id");
            ClientApproverConverter cp = new ClientApproverConverter(caKeyscaProvider);
            .addListener(new DSFSClientApprovalStoreProvider(cp));
                @Override
                public Object componentFound(CfgEvent configurationEvent) {
                    if (checkEvent(configurationEvent)) {
                        return get();
                    }
                    return null;
                }
                @Override
                public ClientApprovalStore get() {
                    return new ClientApprovalMemoryStore(caProvider);
                }
            });
        }
        return ;
    }
        public OA4MP2TProvider(IdentifierProvider<IdentifieridProvider) {
            super(idProvider);
        }
        @Override
        public OA2ServiceTransaction get(boolean createNewIdentifier) {
            return new OA2ServiceTransaction(createNewId(createNewIdentifier));
        }
    }
    long rtLifetime = -1L;
    protected long getRTLifetime() {
        if ( < 0) {
            String x = Configurations.getFirstAttribute(.);
            if (x != null) {
                try {
                     = Long.parseLong(x) * 1000; // The configuration file has this in seconds. Internally this is ms.
                } catch (Throwable t) {
                     = ;
                }
            }
        }
        return ;
    }
    public static class ST2Provider extends DSTransactionProvider<OA2ServiceTransaction> {
        public ST2Provider(IdentifierProvider<IdentifieridProvider) {
            super(idProvider);
        }
        @Override
        public OA2ServiceTransaction get(boolean createNewIdentifier) {
            return new OA2ServiceTransaction(createNewId(createNewIdentifier));
        }
    }
    @Override
    protected MultiDSClientStoreProvider getCSP() {
        if ( == null) {
            OA2ClientConverter converter = new OA2ClientConverter(getClientProvider());
             = new MultiDSClientStoreProvider(isDefaultStoreDisabled(), .get(), nullnullgetClientProvider());
            .addListener(new DSFSClientStoreProvider(convertergetClientProvider()));
                    .,
                    convertergetClientProvider()));
                    .,
                    convertergetClientProvider()));
                @Override
                public Object componentFound(CfgEvent configurationEvent) {
                    if (checkEvent(configurationEvent)) {
                        return get();
                    }
                    return null;
                }
                @Override
                public ClientStore get() {
                    return new ClientMemoryStore(getClientProvider());
                }
            });
        }
        return ;
    }
    @Override
    protected Provider<TransactionStoregetTSP() {
        if ( == null) {
            final IdentifiableProvider tp = new ST2Provider(new OA4MPIdentifierProvider(false));
            OA2TransactionKeys keys = new OA2TransactionKeys();
            OA2MultiTypeProvider storeProvider = new OA2MultiTypeProvider(isDefaultStoreDisabled(), .get(), tp);
            storeProvider.addListener(new OA2SQLTransactionStoreProvider(,
                    getMySQLConnectionPoolProvider(),
                    .,
                    getCSP(),
                    tp,
                    getTokenForgeProvider(),
                    tc));
            storeProvider.addListener(new OA2SQLTransactionStoreProvider(,
                    getPgConnectionPoolProvider(),
                    .,
                    getCSP(),
                    tp,
                    getTokenForgeProvider(),
                    tc));
            storeProvider.addListener(new OA2FSTStoreProvider(tpgetTokenForgeProvider(), tc));
                @Override
                public Object componentFound(CfgEvent configurationEvent) {
                    if (checkEvent(configurationEvent)) {
                        return get();
                    }
                    return null;
                }
                @Override
                public TransactionStore get() {
                    return new OA2MTStore(tp);
                }
            });
             = storeProvider;
        }
        return ;
    }
    @Override
        return getTSP();
    }
    @Override
        return new Provider<TokenForge>() {
            @Override
            public TokenForge get() {
                return new TokenForge2(getServiceAddress().toString());
            }
        };
    }
    @Override
    public Provider<ATIssuergetATIProvider() {
        return new Provider<ATIssuer>() {
            @Override
            public ATIssuer get() {
                return new ATI2(getTokenForgeProvider().get(), getServiceAddress());
            }
        };
    }
    @Override
    public Provider<PAIssuergetPAIProvider() {
        return new Provider<PAIssuer>() {
            @Override
            public PAIssuer get() {
                return new PAI2(getTokenForgeProvider().get(), getServiceAddress());
            }
        };
    }
    @Override
    public IdentifiableProvider<? extends ClientgetClientProvider() {
    }
    @Override
    public String getVersionNumber() {
        return "OAuth 2 for MyProxy, version 1.0.8.";
    }
New to GrepCode? Check out our FAQ X