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 org.mitre.openid.connect.model.UserInfo;
020
021/**
022 * Interface for UserInfo service
023 * 
024 * @author Michael Joseph Walsh
025 * 
026 */
027public interface UserInfoService {
028
029        /**
030         * Save an UserInfo
031         * 
032         * @param userInfo
033         *            the UserInfo to be saved
034         */
035        public void save(UserInfo userInfo);
036
037        /**
038         * Get UserInfo for the Subject
039         * 
040         * @param sub
041         *            subject for UserInfo
042         * @return UserInfo for sub, or null
043         */
044        public UserInfo getBySubject(String userId);
045
046        /**
047         * Remove the UserInfo
048         * 
049         * @param userInfo
050         *            the UserInfo to remove
051         */
052        public void remove(UserInfo userInfo);
053
054
055        /**
056         * Get the UserInfo for the given username (usually maps to the
057         * preferredUsername field).
058         * @param username
059         * @return
060         */
061        public UserInfo getByUsername(String username);
062
063        /**
064         * Get the UserInfo for the given username (usually maps to the
065         * preferredUsername field) and clientId. This allows pairwise
066         * client identifiers where appropriate.
067         * @param username
068         * @param clientId
069         * @return
070         */
071        public UserInfo getByUsernameAndClientId(String username, String clientId);
072
073}