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 *******************************************************************************/
017/**
018 * 
019 */
020package org.mitre.openid.connect.model;
021
022import javax.persistence.Basic;
023import javax.persistence.Column;
024import javax.persistence.Entity;
025import javax.persistence.GeneratedValue;
026import javax.persistence.GenerationType;
027import javax.persistence.Id;
028import javax.persistence.NamedQueries;
029import javax.persistence.NamedQuery;
030import javax.persistence.Table;
031
032/**
033 * 
034 * Holds the generated pairwise identifiers for a user. Can be tied to either a client ID or a sector identifier URL.
035 * 
036 * @author jricher
037 *
038 */
039@Entity
040@Table(name = "pairwise_identifier")
041@NamedQueries({
042        @NamedQuery(name="PairwiseIdentifier.getAll", query = "select p from PairwiseIdentifier p"),
043        @NamedQuery(name="PairwiseIdentifier.getBySectorIdentifier", query = "select p from PairwiseIdentifier p WHERE p.userSub = :sub AND p.sectorIdentifier = :sectorIdentifier")
044})
045public class PairwiseIdentifier {
046
047        private Long id;
048        private String identifier;
049        private String userSub;
050        private String sectorIdentifier;
051
052        /**
053         * @return the id
054         */
055        @Id
056        @GeneratedValue(strategy=GenerationType.IDENTITY)
057        @Column(name = "id")
058        public Long getId() {
059                return id;
060        }
061
062        /**
063         * @param id the id to set
064         */
065        public void setId(Long id) {
066                this.id = id;
067        }
068
069        /**
070         * @return the identifier
071         */
072        @Basic
073        @Column(name = "identifier")
074        public String getIdentifier() {
075                return identifier;
076        }
077
078        /**
079         * @param identifier the identifier to set
080         */
081        public void setIdentifier(String identifier) {
082                this.identifier = identifier;
083        }
084
085        /**
086         * @return the userSub
087         */
088        @Basic
089        @Column(name = "sub")
090        public String getUserSub() {
091                return userSub;
092        }
093
094        /**
095         * @param userSub the userSub to set
096         */
097        public void setUserSub(String userSub) {
098                this.userSub = userSub;
099        }
100
101        /**
102         * @return the sectorIdentifier
103         */
104        @Basic
105        @Column(name = "sector_identifier")
106        public String getSectorIdentifier() {
107                return sectorIdentifier;
108        }
109
110        /**
111         * @param sectorIdentifier the sectorIdentifier to set
112         */
113        public void setSectorIdentifier(String sectorIdentifier) {
114                this.sectorIdentifier = sectorIdentifier;
115        }
116}