4040import java .util .Date ;
4141import java .util .HashMap ;
4242import java .util .LinkedHashMap ;
43- import java .util .List ;
4443import java .util .Map ;
4544import java .util .UUID ;
4645
@@ -68,7 +67,7 @@ public class OidcController {
6867 private Map <String , AccessTokenInfo > accessTokens = new HashMap <>();
6968
7069 @ Autowired
71- private FakeOidcProperties fakeOidcProperties ;
70+ private FakeOidcServerProperties serverProperties ;
7271
7372 @ PostConstruct
7473 public void init () throws IOException , ParseException , JOSEException {
@@ -78,7 +77,7 @@ public void init() throws IOException, ParseException, JOSEException {
7877 signer = new RSASSASigner ((RSAKey ) key );
7978 publicJWKSet = jwkSet .toPublicJWKSet ();
8079 jwsHeader = new JWSHeader .Builder (JWSAlgorithm .RS256 ).keyID (key .getKeyID ()).build ();
81- log .info ("config {}" , fakeOidcProperties );
80+ log .info ("config {}" , serverProperties );
8281 }
8382
8483 @ RequestMapping (value = METADATA_ENDPOINT , method = RequestMethod .GET , produces = MediaType .APPLICATION_JSON_VALUE )
@@ -175,7 +174,7 @@ public ResponseEntity<?> authorize(@RequestParam String client_id,
175174 String [] creds = new String (Base64 .getDecoder ().decode (auth .split (" " )[1 ])).split (":" , 2 );
176175 String logname = creds [0 ];
177176 String password = creds [1 ];
178- User user = fakeOidcProperties .getUser ();
177+ User user = serverProperties .getUser ();
179178 if (user .getLogname ().equals (logname ) && user .getPassword ().equals (password )) {
180179 log .info ("password for user {} is correct" , logname );
181180 String iss = uriBuilder .replacePath ("/" ).build ().encode ().toUriString ();
@@ -197,7 +196,7 @@ public ResponseEntity<?> authorize(@RequestParam String client_id,
197196
198197 private String createAccessToken (String iss , User user , String client_id , String scope ) throws JOSEException {
199198 // create JWT claims
200- Date expiration = new Date (System .currentTimeMillis () + fakeOidcProperties .getTokenExpirationSeconds () * 1000L );
199+ Date expiration = new Date (System .currentTimeMillis () + serverProperties .getTokenExpirationSeconds () * 1000L );
201200 JWTClaimsSet jwtClaimsSet = new JWTClaimsSet .Builder ()
202201 .subject (user .getSub ())
203202 .issuer (iss )
@@ -230,7 +229,7 @@ private String createIdToken(String iss, User user, String client_id, String non
230229 .issuer (iss )
231230 .audience (client_id )
232231 .issueTime (new Date ())
233- .expirationTime (new Date (System .currentTimeMillis () + fakeOidcProperties .getTokenExpirationSeconds () * 1000L ))
232+ .expirationTime (new Date (System .currentTimeMillis () + serverProperties .getTokenExpirationSeconds () * 1000L ))
234233 .jwtID (UUID .randomUUID ().toString ())
235234 .claim ("nonce" , nonce )
236235 .claim ("at_hash" , encodedHash )
0 commit comments