|
| 1 | +/* |
| 2 | + * Copyright 2022 the original author or authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package org.springframework.security.oauth2.server.authorization; |
| 17 | + |
| 18 | +import java.time.Instant; |
| 19 | +import java.util.Map; |
| 20 | +import java.util.Set; |
| 21 | + |
| 22 | +/** |
| 23 | + * Resource containing the data of an {@link OAuth2Authorization} object. |
| 24 | + * |
| 25 | + * @author Steve Riesenberg |
| 26 | + * @since 0.2.2 |
| 27 | + */ |
| 28 | +public class OAuth2AuthorizationResource { |
| 29 | + private String id; |
| 30 | + private String registeredClientId; |
| 31 | + private String principalName; |
| 32 | + private String authorizationGrantType; |
| 33 | + private String state; |
| 34 | + private Set<String> scopes; |
| 35 | + private Map<String, Object> attributes; |
| 36 | + private Map<String, OAuth2TokenResource> tokens; |
| 37 | + |
| 38 | + public String getId() { |
| 39 | + return id; |
| 40 | + } |
| 41 | + |
| 42 | + public void setId(String id) { |
| 43 | + this.id = id; |
| 44 | + } |
| 45 | + |
| 46 | + public String getRegisteredClientId() { |
| 47 | + return registeredClientId; |
| 48 | + } |
| 49 | + |
| 50 | + public void setRegisteredClientId(String registeredClientId) { |
| 51 | + this.registeredClientId = registeredClientId; |
| 52 | + } |
| 53 | + |
| 54 | + public String getPrincipalName() { |
| 55 | + return principalName; |
| 56 | + } |
| 57 | + |
| 58 | + public void setPrincipalName(String principalName) { |
| 59 | + this.principalName = principalName; |
| 60 | + } |
| 61 | + |
| 62 | + public String getAuthorizationGrantType() { |
| 63 | + return authorizationGrantType; |
| 64 | + } |
| 65 | + |
| 66 | + public void setAuthorizationGrantType(String authorizationGrantType) { |
| 67 | + this.authorizationGrantType = authorizationGrantType; |
| 68 | + } |
| 69 | + |
| 70 | + public String getState() { |
| 71 | + return state; |
| 72 | + } |
| 73 | + |
| 74 | + public void setState(String state) { |
| 75 | + this.state = state; |
| 76 | + } |
| 77 | + |
| 78 | + public Set<String> getScopes() { |
| 79 | + return scopes; |
| 80 | + } |
| 81 | + |
| 82 | + public void setScopes(Set<String> scopes) { |
| 83 | + this.scopes = scopes; |
| 84 | + } |
| 85 | + |
| 86 | + public Map<String, Object> getAttributes() { |
| 87 | + return attributes; |
| 88 | + } |
| 89 | + |
| 90 | + public void setAttributes(Map<String, Object> attributes) { |
| 91 | + this.attributes = attributes; |
| 92 | + } |
| 93 | + |
| 94 | + public Map<String, OAuth2TokenResource> getTokens() { |
| 95 | + return tokens; |
| 96 | + } |
| 97 | + |
| 98 | + public void setTokens(Map<String, OAuth2TokenResource> tokens) { |
| 99 | + this.tokens = tokens; |
| 100 | + } |
| 101 | + |
| 102 | + public static class OAuth2TokenResource { |
| 103 | + private String tokenValue; |
| 104 | + private Instant issuedAt; |
| 105 | + private Instant expiresAt; |
| 106 | + private Map<String, Object> metadata; |
| 107 | + |
| 108 | + public String getTokenValue() { |
| 109 | + return tokenValue; |
| 110 | + } |
| 111 | + |
| 112 | + public void setTokenValue(String tokenValue) { |
| 113 | + this.tokenValue = tokenValue; |
| 114 | + } |
| 115 | + |
| 116 | + public Instant getIssuedAt() { |
| 117 | + return issuedAt; |
| 118 | + } |
| 119 | + |
| 120 | + public void setIssuedAt(Instant issuedAt) { |
| 121 | + this.issuedAt = issuedAt; |
| 122 | + } |
| 123 | + |
| 124 | + public Instant getExpiresAt() { |
| 125 | + return expiresAt; |
| 126 | + } |
| 127 | + |
| 128 | + public void setExpiresAt(Instant expiresAt) { |
| 129 | + this.expiresAt = expiresAt; |
| 130 | + } |
| 131 | + |
| 132 | + public Map<String, Object> getMetadata() { |
| 133 | + return metadata; |
| 134 | + } |
| 135 | + |
| 136 | + public void setMetadata(Map<String, Object> metadata) { |
| 137 | + this.metadata = metadata; |
| 138 | + } |
| 139 | + } |
| 140 | +} |
0 commit comments