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