// Path: src/main/java/org/osiam/security/authentication/OsiamClientDetailsService.java
// @Service
// public class OsiamClientDetailsService implements ClientDetailsService {
// 
//     @Autowired
//     private ClientRepository clientRepository;
// 
//     @Override
//     public ClientDetails loadClientByClientId(final String clientId) {
//         return clientRepository.findById(clientId);
//     }
// }


import javax.servlet.http.HttpSession;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import org.osiam.security.authentication.OsiamClientDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.provider.AuthorizationRequest;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.approval.DefaultUserApprovalHandler;
import org.springframework.stereotype.Component;
/*
 * Copyright (C) 2013 tarent AG
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package org.osiam.security.authorization;



/**
 * A default user approval handler that doesn't remember any decisions.
 *
 * @author Dave Syer
 */
@Component
public class OsiamUserApprovalHandler extends DefaultUserApprovalHandler {

    private static final String APPROVALS_SESSION_KEY = "osiam_oauth_approvals";
    private static final String IS_PRE_APPROVED_PARAMETER = "osiam_is_pre_approved";

    @Autowired
    private HttpSession httpSession;

    @Autowired
// Path: src/main/java/org/osiam/security/authentication/OsiamClientDetailsService.java
// @Service
// public class OsiamClientDetailsService implements ClientDetailsService {
// 
//     @Autowired
//     private ClientRepository clientRepository;
// 
//     @Override
//     public ClientDetails loadClientByClientId(final String clientId) {
//         return clientRepository.findById(clientId);
//     }
// }


// Path: src/main/java/org/osiam/security/authorization/OsiamUserApprovalHandler.java
import javax.servlet.http.HttpSession;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import org.osiam.security.authentication.OsiamClientDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.provider.AuthorizationRequest;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.approval.DefaultUserApprovalHandler;
import org.springframework.stereotype.Component;

/*
 * Copyright (C) 2013 tarent AG
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package org.osiam.security.authorization;



/**
 * A default user approval handler that doesn't remember any decisions.
 *
 * @author Dave Syer
 */
@Component
public class OsiamUserApprovalHandler extends DefaultUserApprovalHandler {

    private static final String APPROVALS_SESSION_KEY = "osiam_oauth_approvals";
    private static final String IS_PRE_APPROVED_PARAMETER = "osiam_is_pre_approved";

    @Autowired
    private HttpSession httpSession;

    @Autowired
    private OsiamClientDetailsService osiamClientDetailsService;