src/java.base/share/classes/java/security/Identity.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 51759 ac6e9a2ebc04
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    60 @Deprecated(since="1.2", forRemoval=true)
    60 @Deprecated(since="1.2", forRemoval=true)
    61 @SuppressWarnings("removal")
    61 @SuppressWarnings("removal")
    62 public abstract class Identity implements Principal, Serializable {
    62 public abstract class Identity implements Principal, Serializable {
    63 
    63 
    64     /** use serialVersionUID from JDK 1.1.x for interoperability */
    64     /** use serialVersionUID from JDK 1.1.x for interoperability */
       
    65     @java.io.Serial
    65     private static final long serialVersionUID = 3609922007826600659L;
    66     private static final long serialVersionUID = 3609922007826600659L;
    66 
    67 
    67     /**
    68     /**
    68      * The name for this identity.
    69      * The name for this identity.
    69      *
    70      *
   110      * Constructs an identity with the specified name and scope.
   111      * Constructs an identity with the specified name and scope.
   111      *
   112      *
   112      * @param name the identity name.
   113      * @param name the identity name.
   113      * @param scope the scope of the identity.
   114      * @param scope the scope of the identity.
   114      *
   115      *
   115      * @exception KeyManagementException if there is already an identity
   116      * @throws    KeyManagementException if there is already an identity
   116      * with the same name in the scope.
   117      * with the same name in the scope.
   117      */
   118      */
   118     public Identity(String name, IdentityScope scope) throws
   119     public Identity(String name, IdentityScope scope) throws
   119     KeyManagementException {
   120     KeyManagementException {
   120         this(name);
   121         this(name);
   170      * method is called with {@code "setIdentityPublicKey"}
   171      * method is called with {@code "setIdentityPublicKey"}
   171      * as its argument to see if it's ok to set the public key.
   172      * as its argument to see if it's ok to set the public key.
   172      *
   173      *
   173      * @param key the public key for this identity.
   174      * @param key the public key for this identity.
   174      *
   175      *
   175      * @exception KeyManagementException if another identity in the
   176      * @throws    KeyManagementException if another identity in the
   176      * identity's scope has the same public key, or if another exception occurs.
   177      * identity's scope has the same public key, or if another exception occurs.
   177      *
   178      *
   178      * @exception  SecurityException  if a security manager exists and its
   179      * @throws     SecurityException  if a security manager exists and its
   179      * {@code checkSecurityAccess} method doesn't allow
   180      * {@code checkSecurityAccess} method doesn't allow
   180      * setting the public key.
   181      * setting the public key.
   181      *
   182      *
   182      * @see #getPublicKey
   183      * @see #getPublicKey
   183      * @see SecurityManager#checkSecurityAccess
   184      * @see SecurityManager#checkSecurityAccess
   197      * method is called with {@code "setIdentityInfo"}
   198      * method is called with {@code "setIdentityInfo"}
   198      * as its argument to see if it's ok to specify the information string.
   199      * as its argument to see if it's ok to specify the information string.
   199      *
   200      *
   200      * @param info the information string.
   201      * @param info the information string.
   201      *
   202      *
   202      * @exception  SecurityException  if a security manager exists and its
   203      * @throws     SecurityException  if a security manager exists and its
   203      * {@code checkSecurityAccess} method doesn't allow
   204      * {@code checkSecurityAccess} method doesn't allow
   204      * setting the information string.
   205      * setting the information string.
   205      *
   206      *
   206      * @see #getInfo
   207      * @see #getInfo
   207      * @see SecurityManager#checkSecurityAccess
   208      * @see SecurityManager#checkSecurityAccess
   232      * method is called with {@code "addIdentityCertificate"}
   233      * method is called with {@code "addIdentityCertificate"}
   233      * as its argument to see if it's ok to add a certificate.
   234      * as its argument to see if it's ok to add a certificate.
   234      *
   235      *
   235      * @param certificate the certificate to be added.
   236      * @param certificate the certificate to be added.
   236      *
   237      *
   237      * @exception KeyManagementException if the certificate is not valid,
   238      * @throws    KeyManagementException if the certificate is not valid,
   238      * if the public key in the certificate being added conflicts with
   239      * if the public key in the certificate being added conflicts with
   239      * this identity's public key, or if another exception occurs.
   240      * this identity's public key, or if another exception occurs.
   240      *
   241      *
   241      * @exception  SecurityException  if a security manager exists and its
   242      * @throws     SecurityException  if a security manager exists and its
   242      * {@code checkSecurityAccess} method doesn't allow
   243      * {@code checkSecurityAccess} method doesn't allow
   243      * adding a certificate.
   244      * adding a certificate.
   244      *
   245      *
   245      * @see SecurityManager#checkSecurityAccess
   246      * @see SecurityManager#checkSecurityAccess
   246      */
   247      */
   283      * method is called with {@code "removeIdentityCertificate"}
   284      * method is called with {@code "removeIdentityCertificate"}
   284      * as its argument to see if it's ok to remove a certificate.
   285      * as its argument to see if it's ok to remove a certificate.
   285      *
   286      *
   286      * @param certificate the certificate to be removed.
   287      * @param certificate the certificate to be removed.
   287      *
   288      *
   288      * @exception KeyManagementException if the certificate is
   289      * @throws    KeyManagementException if the certificate is
   289      * missing, or if another exception occurs.
   290      * missing, or if another exception occurs.
   290      *
   291      *
   291      * @exception  SecurityException  if a security manager exists and its
   292      * @throws     SecurityException  if a security manager exists and its
   292      * {@code checkSecurityAccess} method doesn't allow
   293      * {@code checkSecurityAccess} method doesn't allow
   293      * removing a certificate.
   294      * removing a certificate.
   294      *
   295      *
   295      * @see SecurityManager#checkSecurityAccess
   296      * @see SecurityManager#checkSecurityAccess
   296      */
   297      */
   397      * as its argument to see if it's ok to return the string.
   398      * as its argument to see if it's ok to return the string.
   398      *
   399      *
   399      * @return information about this identity, such as its name and the
   400      * @return information about this identity, such as its name and the
   400      * name of its scope (if any).
   401      * name of its scope (if any).
   401      *
   402      *
   402      * @exception  SecurityException  if a security manager exists and its
   403      * @throws     SecurityException  if a security manager exists and its
   403      * {@code checkSecurityAccess} method doesn't allow
   404      * {@code checkSecurityAccess} method doesn't allow
   404      * returning a string describing this identity.
   405      * returning a string describing this identity.
   405      *
   406      *
   406      * @see SecurityManager#checkSecurityAccess
   407      * @see SecurityManager#checkSecurityAccess
   407      */
   408      */
   427      *
   428      *
   428      * @return information about this identity. If {@code detailed}
   429      * @return information about this identity. If {@code detailed}
   429      * is true, then this method returns more information than that
   430      * is true, then this method returns more information than that
   430      * provided by the {@code toString} method without any arguments.
   431      * provided by the {@code toString} method without any arguments.
   431      *
   432      *
   432      * @exception  SecurityException  if a security manager exists and its
   433      * @throws     SecurityException  if a security manager exists and its
   433      * {@code checkSecurityAccess} method doesn't allow
   434      * {@code checkSecurityAccess} method doesn't allow
   434      * returning a string describing this identity.
   435      * returning a string describing this identity.
   435      *
   436      *
   436      * @see #toString
   437      * @see #toString
   437      * @see SecurityManager#checkSecurityAccess
   438      * @see SecurityManager#checkSecurityAccess