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