| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| SecretKeyCallback |
|
| 1.0;1 | ||||
| SecretKeyCallback$AliasRequest |
|
| 1.0;1 | ||||
| SecretKeyCallback$Request |
|
| 1.0;1 |
| 1 | /** | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | package javax.security.auth.message.callback; | |
| 18 | ||
| 19 | import javax.security.auth.callback.Callback; | |
| 20 | import javax.crypto.SecretKey; | |
| 21 | ||
| 22 | /** | |
| 23 | * A callback enabling an authentication module to request a secret key from the runtime, by supplying an alias. | |
| 24 | * Other request types may also be supported. | |
| 25 | * | |
| 26 | * @version $Rev: 768352 $ $Date: 2009-04-24 09:26:01 -0700 (Fri, 24 Apr 2009) $ | |
| 27 | */ | |
| 28 | public class SecretKeyCallback implements Callback { | |
| 29 | ||
| 30 | private final Request request; | |
| 31 | private SecretKey key; | |
| 32 | ||
| 33 | 0 | public SecretKeyCallback(Request request) { |
| 34 | 0 | this.request = request; |
| 35 | 0 | } |
| 36 | ||
| 37 | public Request getRequest() { | |
| 38 | 0 | return request; |
| 39 | } | |
| 40 | ||
| 41 | public SecretKey getKey() { | |
| 42 | 0 | return key; |
| 43 | } | |
| 44 | ||
| 45 | public void setKey(SecretKey key) { | |
| 46 | 0 | this.key = key; |
| 47 | 0 | } |
| 48 | ||
| 49 | public static interface Request { | |
| 50 | } | |
| 51 | ||
| 52 | public static class AliasRequest implements Request { | |
| 53 | ||
| 54 | private final String alias; | |
| 55 | ||
| 56 | 0 | public AliasRequest(String alias) { |
| 57 | 0 | this.alias = alias; |
| 58 | 0 | } |
| 59 | ||
| 60 | public String getAlias() { | |
| 61 | 0 | return alias; |
| 62 | } | |
| 63 | } | |
| 64 | } |