001/*******************************************************************************
002 * Copyright 2014 The MITRE Corporation
003 *   and the MIT Kerberos and Internet Trust Consortium
004 * 
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 * 
009 *   http://www.apache.org/licenses/LICENSE-2.0
010 * 
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 ******************************************************************************/
017package org.mitre.openid.connect.service;
018
019import java.util.Date;
020
021import org.mitre.oauth2.model.ClientDetailsEntity;
022import org.mitre.oauth2.model.OAuth2AccessTokenEntity;
023import org.springframework.security.oauth2.provider.OAuth2Request;
024
025/**
026 * Service to create specialty OpenID Connect tokens.
027 * 
028 * @author Amanda Anganes
029 *
030 */
031public interface OIDCTokenService {
032
033        /**
034         * Create an id token with the information provided.
035         * 
036         * @param client
037         * @param request
038         * @param issueTime
039         * @param sub
040         * @param signingAlg
041         * @param accessToken
042         * @return
043         */
044        public OAuth2AccessTokenEntity createIdToken(
045                        ClientDetailsEntity client, OAuth2Request request, Date issueTime,
046                        String sub, OAuth2AccessTokenEntity accessToken);
047
048        /**
049         * Create a registration access token for the given client.
050         * 
051         * @param client
052         * @return
053         */
054        public OAuth2AccessTokenEntity createRegistrationAccessToken(ClientDetailsEntity client);
055
056        /**
057         * Create a resource access token for the given client (protected resource).
058         * 
059         * @param client
060         * @return
061         */
062        public OAuth2AccessTokenEntity createResourceAccessToken(ClientDetailsEntity client);
063
064        /**
065         * Rotate the registration or resource token for a client
066         * @param client
067         * @return
068         */
069        public OAuth2AccessTokenEntity rotateRegistrationAccessTokenForClient(ClientDetailsEntity client);
070
071}