AuthorizeCallback.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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.sasl;
  18. import java.io.Serializable;
  19. import javax.security.auth.callback.Callback;
  20. public class AuthorizeCallback implements Callback, Serializable {
  21. private static final long serialVersionUID = -2353344186490470805L;
  22. /**
  23. * Serialized field for storing authenticationID.
  24. */
  25. private final String authenticationID;
  26. /**
  27. * Serialized field for storing authorizationID.
  28. */
  29. private final String authorizationID;
  30. /**
  31. * Serialized field for storing authorizedID.
  32. */
  33. private String authorizedID;
  34. /**
  35. * Store authorized Serialized field.
  36. */
  37. private boolean authorized;
  38. public AuthorizeCallback(String authnID, String authzID) {
  39. super();
  40. authenticationID = authnID;
  41. authorizationID = authzID;
  42. authorizedID = authzID;
  43. }
  44. public String getAuthenticationID() {
  45. return authenticationID;
  46. }
  47. public String getAuthorizationID() {
  48. return authorizationID;
  49. }
  50. public String getAuthorizedID() {
  51. return (authorized ? authorizedID : null);
  52. }
  53. public boolean isAuthorized() {
  54. return authorized;
  55. }
  56. public void setAuthorized(boolean ok) {
  57. authorized = ok;
  58. }
  59. public void setAuthorizedID(String id) {
  60. if (id != null) {
  61. authorizedID = id;
  62. }
  63. }
  64. }