aboutsummaryrefslogtreecommitdiffstats
path: root/odl-aaa-moon/aaa/aaa-authn-sts/src/main/java/org/opendaylight/aaa/sts/OAuthRequest.java
blob: 2a2b34b6bb8e5bb3bbdbd690373a930705101f32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * Copyright (c) 2014, 2015 Hewlett-Packard Development Company, L.P. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.aaa.sts;

import javax.servlet.http.HttpServletRequest;
import org.apache.oltu.oauth2.as.request.AbstractOAuthTokenRequest;
import org.apache.oltu.oauth2.as.validator.UnauthenticatedAuthorizationCodeValidator;
import org.apache.oltu.oauth2.common.exception.OAuthProblemException;
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
import org.apache.oltu.oauth2.common.message.types.GrantType;
import org.apache.oltu.oauth2.common.validators.OAuthValidator;

/**
 * OAuth request wrapper.
 *
 * @author liemmn
 *
 */
public class OAuthRequest extends AbstractOAuthTokenRequest {

    public OAuthRequest(HttpServletRequest request) throws OAuthSystemException,
            OAuthProblemException {
        super(request);
    }

    @Override
    public OAuthValidator<HttpServletRequest> initValidator() throws OAuthProblemException,
            OAuthSystemException {
        validators.put(GrantType.PASSWORD.toString(), AnonymousPasswordValidator.class);
        validators.put(GrantType.REFRESH_TOKEN.toString(), AnonymousRefreshTokenValidator.class);
        validators.put(GrantType.AUTHORIZATION_CODE.toString(),
                UnauthenticatedAuthorizationCodeValidator.class);
        return super.initValidator();
    }

}